Skip to Content
avatar image
Former Member

Crystal in B1 8.8 - optional parameters not working

I have defined a business partner parameter

Name is

Customers@SELECT cardcode, cardname FROM OCRD WHERE Cardtype = 'C'

Flagged as optional and allow range

Used in record selection as follows

(not HasValue({?Customers@SELECT cardcode, cardname FROM OCRD WHERE Cardtype = 'C'}) OR {OCRD.CardCode} = {?Customers@SELECT cardcode, cardname FROM OCRD WHERE Cardtype = 'C'})

When running in the designer, if no values entered then all business partners selected as expected.

When running through B1 if no values are entered then no records are selected rathr than all records. Works OK if start or end ranges or both are supplied. Eg. Start only gets all customers from that code to end and end only gets all customers before that code.

Any ideas on how to make it completely optional?

Is there an issue with HASVALUE?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Apr 26, 2010 at 09:26 AM

    Hi Rob,

    I had the same results as you when making an optional parameter for CardCode on OCRD.

    I came up with this workaround:

    1. Create parameter to use SQL Token like:

    Custcode@Select Cardcode,Cardname,Balance from OCRD where cardtype='c'

    2. Create a Formula field (I saved the formula as CustCode)

    If Length ({?Custcode@Select Cardcode,Cardname,Balance from OCRD where cardtype='c'}) > 0 then {?Custcode@Select Cardcode,Cardname,Balance from OCRD where cardtype='c'} else "blank"

    3 Make your Record Selection formula something like this:

    If {@CustCode} = "Blank"

    then {OCRD.CardCode} <> "Blank" (Note: for some reason the forum doesn't display the not equals here)

    else

    (not HasValue({?Custcode@Select Cardcode,Cardname,Balance from OCRD where cardtype='c'}) OR {OCRD.CardCode} = {?Custcode@Select Cardcode,Cardname,Balance from OCRD where cardtype='c'})

    Hope this helps!

    Daryl

    Edited by: Daryl Goodman on Apr 26, 2010 11:28 AM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Just to conclude,

      Thanks Julie/Rob,

      I have requested our admin guys to get Crystal reports 2008 & I am waiting for it.

      Meanwhile, I tried the following token using "Union all" or "Union" and added an extra record 'All' & 'All' as the first record along with the other valid values.

      "customerno@select cardcode, cardname from ocrd where cardtype union all select 'All', 'All' order by cardcode"

      I had to do this, since I was not able to add 'All' & make it work in SAP B1 through 'Default value' in 'Edit parameter' my version. Anyway, now I have asked the user to select the first record 'All' - 'All' if they want all records and I am handling the value 'All' in record selection formula to skip the filtering. It works fine.

      Another interesting thing is, if you pass Null instead of first 'All' in the above token, it automatically defaults 'All' in the initial screen which is very good as the user doesn't have to select 'All' every time. But unfortunately, the key value is passed as 'blank' - Null and I get the 'Parameter mandatory' error again. So I am not using that option.

      Regards,

      Gokul

  • avatar image
    Former Member
    Apr 27, 2010 at 01:50 AM

    marked as unanswered so as to enter a comment

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 27, 2010 at 01:52 AM

    Note in my comment above regarding setting parameters based on min and max values. This only works when running in B1 because it always assumes that hasvalue() is true

    Add comment
    10|10000 characters needed characters exceeded