Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Use a function in CrystalreportViewer.SelectionFormula

Use a function in CrystalreportViewer.SelectionFormula

Scheduled Pinned Locked Moved Visual Basic
helpcsharpdatabasetutorial
4 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dcode25
    wrote on last edited by
    #1

    I have an application in Vb.net. There is a crystalreport that displays records from an access Database.But i want to filter records that report displays.Each records has 6 fields and one of this is LisTR. I have a function VerifyS(...) as boolean , this function get as argument the value of this field and return true if the record that have this filed should display in the report or no. But i have problem using this function. I use : CrystalReportViewers1.SelectionFormula=("VerifyS{Table1.LisTr}=True") But i get an error So , How to use a function inside SelectionFormula? Thank You !

    D 1 Reply Last reply
    0
    • D dcode25

      I have an application in Vb.net. There is a crystalreport that displays records from an access Database.But i want to filter records that report displays.Each records has 6 fields and one of this is LisTR. I have a function VerifyS(...) as boolean , this function get as argument the value of this field and return true if the record that have this filed should display in the report or no. But i have problem using this function. I use : CrystalReportViewers1.SelectionFormula=("VerifyS{Table1.LisTr}=True") But i get an error So , How to use a function inside SelectionFormula? Thank You !

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      If this VerifyS function is defined in your VB.NET code, you can NOT use it in the SelectionFormula filter. Last I knew, CrystalReports cannot call back into your code to call functions. The way around this would be to add a field to your table that your code can modify based upon your rules, then you can use that field in the SelectionFormula to filter the records.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      D 1 Reply Last reply
      0
      • D Dave Kreskowiak

        If this VerifyS function is defined in your VB.NET code, you can NOT use it in the SelectionFormula filter. Last I knew, CrystalReports cannot call back into your code to call functions. The way around this would be to add a field to your table that your code can modify based upon your rules, then you can use that field in the SelectionFormula to filter the records.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        D Offline
        D Offline
        dcode25
        wrote on last edited by
        #3

        Thank You. Ok , i change my code and now i want to display in My crystal report only those records that have the maximum value in the filed LisTR. Can i use the function Max or something else to do this. ( so is possible to use in SelectionFormula a standart function of vb.net ?) Thank You

        D 1 Reply Last reply
        0
        • D dcode25

          Thank You. Ok , i change my code and now i want to display in My crystal report only those records that have the maximum value in the filed LisTR. Can i use the function Max or something else to do this. ( so is possible to use in SelectionFormula a standart function of vb.net ?) Thank You

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          mysybet123 wrote:

          so is possible to use in SelectionFormula a standart function of vb.net

          Didn't I just get done telling, "No, it's not possible."?? Stop thinking in terms of VB code in the SelectionFormula and start thinking in terms of either SQL or CrystalReports syntax.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups