Results 1 to 3 of 3

Thread: Selection formula w Nulls

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2009
    Location
    Sweden
    Posts
    159

    Question Selection formula w Nulls

    Hi all!
    Step on an annoying thing yesterday(DF 18 and Crystal XI).
    I have two 'almost' exact looking ComRecordSelectionFormulas.

    Code:
    //With string "0"(zero) in sSarskild
    Move (sSelection+(If(sSelection<>""," and ",""))+"{RECEPT.SARSKILT} ="+(Trim(sSarskild))+(If(sSelection<>""," and ","")+"{RECEPT.DATUM} = "+(WinQL_Date(dFromSjtypantStatusdat)))) to sSelection 
    
    Set ComRecordSelectionFormula of hoReport to sSelection
    
    //With string "1" in sSarskild
    Move (sSelection+(If(sSelection<>""," and ",""))+"{RECEPT.SARSKILT} ="+(Trim(sSarskild))+(If(sSelection<>""," and ","")+"{RECEPT.DATUM} = "+(WinQL_Date(dFromSjtypantStatusdat)))) to sSelection 
    
    Set ComRecordSelectionFormula of hoReport to sSelection
    The resulting selection strings are:

    Code:
    //Not working
    {RECEPT.PNR}="198808112380" and {RECEPT.SARSKILT} =0 and {RECEPT.DATUM} = Date (2018, 08, 24) 
    
    //Working
    {RECEPT.PNR}="198808112380" and {RECEPT.SARSKILT} =1 and {RECEPT.DATUM} = Date (2018, 08, 27)




    The difference is the string value "1" versus "0".
    With value "1" it works fine, and the report prints on screen.
    BUT, when value is "0", an error pops up first time the print button is clicked.
    If I click Print button a second time, it works!


    I guess I'm missing something that has to do´with null values and strings here :-)
    Any answers appreciated!

    Best Regards
    Mikael Olsson, RixData
    Sweden
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	screenshot2.png 
Views:	61 
Size:	123.3 KB 
ID:	12227  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •