cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Crystal Reports 2020 Runtime Java - Error parameter values missing

diegofava
Explorer
0 Likes
1,130

Goodmorning,

I have an rpt with parameter fields, that are used in the report.

If I try to execute a print, without assigning values to some of that parameters at runtime (I'm using the Java SDK), I get this error:

com.crystaldecisions.sdk.occa.report.lib.ReportSDKParameterFieldException: 
Some parameters have missing values---- Error code:-2147217394 Error code name:missingParameterValueError

I checked that in the SDK, working on the IParameterField object, I can access to:

  • initialValues
  • defaultValues
  • currentValues

Below the corrispondences in the designer of CR2020:

I finally noticed that I MUST assign one value to the currentValue of the parameter, to avoid the error, and for now I'm using those default values if they're present.

Now the question is:

Why doesn't Crystal automatically assign one between defaultValues and initialValues to the actualValues? It seems very strange...

I have also found two methods:

  1. setAllowNullValues(boolean)
  2. setIsOptionalPrompt(boolean)

    that I can call on the parameter passing 'true', but they don't work. For the first method in the doc. it says 'This is used only for stored SQL procedures.', the second instead seems to be the most appropriate one, but it doesn't solve the issue either.

    This way would be the best, because I don't need to assign the default values, I only need to avoid the exception and allow null values on parameter fields.

    So the other question is:

    Is it possible to allow null values on parameter fields? If yes, how?

    Thanks to everybody, any help would be appreciated.

    Diego.

    Accepted Solutions (0)

    Answers (2)

    Answers (2)

    DonWilliams
    Active Contributor
    0 Likes

    Often depending on the API used you may not be doing it the right way.

    For example don use .ADD it could be you are trying to add the same Parameter name to the list of parameters.

    Also, Java may be interpreting the value as a string...

    Have a look at these Java samples:

    https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports+Java++SDK+Samples

    DellSC
    Active Contributor
    0 Likes

    Have you tried setting the "Optional Prompt" property to True?

    -Dell

    diegofava
    Explorer
    0 Likes

    Yes, I've tried setting that property with the relative method setIsOptionalPrompt(true).

    I forgot it in the question, now I've updated the question too.

    Are there any other ways?

    Thanks,

    Diego