cancel
Showing results for 
Search instead for 
Did you mean: 

How to find parameter values of a Crystal report

Former Member
0 Kudos

CS2008 SP3 - version 12.3.0.601

Is there any way parameter value of a report can be found? The following code doesn't return parameter value but returns name.

Fields existingReportParameters = null;

                        IDataDefinition dataDefinition = reportDocument.getDataDefinition();

                        existingReportParameters = dataDefinition.getParameterFields();

                        if (existingReportParameters != null) {

                              for (int i = 0; i < existingReportParameters.size(); i++) {

                                    IField field = existingReportParameters.getField(i);

                                    if (field instanceof ParameterField) {

                                          ParameterField pa = (ParameterField)field;

                                          String paramName = pa.getName();

                                          //Values values = pa.getValues();

                                          //Object value = values.get(0);

                                          //System.out.println("*** repName Parameter - " + paramName + ":" + values);

                                          System.out.println("*** repName Parameter - " + paramName);

                                    }

                              }

                        }

Need to find a solution soon. Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

See this:

Thanks,

DJ

Answers (2)

Answers (2)

0 Kudos

Hello,

First link is to get the parameter collection and Brian's link is how to add them at runtime.

I believe what you are looking for is a way to get the values that are defaults in the report correct?

If so see this post:

Don

Former Member
0 Kudos

Thanks all for the reply.

I am trying to solve a problem where report parameter value that is set at Management Console is wiped out after calling replaceConnection.

databaseController.replaceConnection(oldConnectionInfo, newConnectionInfo,
null,DBOptions._doNotVerifyDB);

We have to support changing database connection from a java utility

class. But once replaceConnection is called all existing static parameter values are lost. To fix this issue we thought of getting parameters and values before calling replaceConnection and setting it after replaceConnection.

Version is CS2008 SP3 - version 12.3.0.601

If there is any other option of fixing the original wipe out issue?

ParameterValues.getValues() didn't return value. I will try ParameterValues.getCurrentCalues() but the document says ParameterValues.getValues() is  equivalent to the IParameterField.getCurrentValues() method  unless it is empty, in which case it is equivalent  to the IParameterField.getDefaultValues() method.

So getCurrentValues() may not work.

Former Member
0 Kudos

Attached a screen shot that shows where we see empty parameter values .

former_member292966
Active Contributor
0 Kudos

Hi Sarmistha,

The ParameterField object should have a method called CurrentValues. 

Have a look at this article. 

https://msdn.microsoft.com/en-us/library/aa289936(v=vs.71).aspx

Good luck,

Brian