cancel
Showing results for 
Search instead for 
Did you mean: 

cr4e Problem with optional parameter when empty

Former Member
0 Kudos

Hi,

<br><br>

I have a problem with cr4e (12 update 4) when I try to put to my report an optional parameter with no value.

The program crashes with an exception because the function com.crystaldecisions.reports.common.value.SpecialCrystalValue.getValueType is called on my optional parameter which is empty.

<br><br>

here is an extract of my program when I put my parameters :

<br><br>

if (StringUtils.isEmpty(parametre.getValeur())) {
											Values noValues = new Values();
											noValues.setIsNoValue(true);
											CRJavaHelper.addDiscreteParameterValue(reportClientDoc, "", parametre
													.getNom(), noValues);
										} else {
											CRJavaHelper.addDiscreteParameterValue(reportClientDoc, "", parametre
													.getNom(), parametre.getValeur());
										}

<br><br>

and this is the exception when the report is exported or displayed in the viewer :

<br><br>

 
com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: Programming error, this function should never be called.---- Error code:-2147467259 Error code name:failed

at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.if(SourceFile:237)

at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:147)

at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:128)

at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(SourceFile:111)

at com.businessobjects.core.CRJavaTraitement.writeByteArrayInputStream(CRJavaTraitement.java:218)

at com.businessobjects.core.CRJavaTraitement.main(CRJavaTraitement.java:159)

Caused by: java.lang.UnsupportedOperationException: Programming error, this function should never be called.

at com.crystaldecisions.reports.common.value.SpecialCrystalValue.getValueType(Unknown Source)

at com.crystaldecisions.reports.reportdefinition.FormattedFieldValue.if(SourceFile:465)

at com.crystaldecisions.reports.reportdefinition.FormattedFieldValue.a(SourceFile:155)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.FormattedTextObject.a(SourceFile:451)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.FormattedTextObject.a(SourceFile:359)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.FormattedTextObject.do(SourceFile:274)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.AbstractFormattedTextualObject.a(SourceFile:282)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.w.for(SourceFile:126)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.aa.a(SourceFile:64)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.ObjectFormatter.a(SourceFile:428)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.ObjectFormatter.a(SourceFile:250)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.u.a(SourceFile:922)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.u.e(SourceFile:784)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.u.for(SourceFile:242)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.aa.a(SourceFile:64)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.ObjectFormatter.a(SourceFile:243)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.ObjectFormatter.a(SourceFile:210)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.v.a(SourceFile:185)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.v.a(SourceFile:230)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.ai.for(SourceFile:359)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.ai.for(SourceFile:133)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.ColumnFormatter.for(SourceFile:120)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.aa.a(SourceFile:64)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.ai.a(SourceFile:511)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.ai.a(SourceFile:452)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.ai.a(SourceFile:369)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.ah.a(SourceFile:72)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.ReportColumnFormatter.a(SourceFile:86)

at com.crystaldecisions.reports.formatter.formatter.paginator.SinglePageFormatter.a(SourceFile:332)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.ai.for(SourceFile:359)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.ai.for(SourceFile:133)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.ColumnFormatter.for(SourceFile:120)

at com.crystaldecisions.reports.formatter.formatter.paginator.SinglePageFormatter.for(SourceFile:177)

at com.crystaldecisions.reports.formatter.formatter.objectformatter.aa.a(SourceFile:64)

at com.crystaldecisions.reports.formatter.formatter.paginator.PageFormatter.do(SourceFile:727)

at com.crystaldecisions.reports.formatter.formatter.paginator.PageFormatter.formatPage(SourceFile:226)

at com.crystaldecisions.reports.formatter.export2.a.a(SourceFile:96)

at com.crystaldecisions.reports.formatter.export2.a.a(SourceFile:234)

at com.crystaldecisions.reports.formatter.export2.ExportSupervisorEx.if(SourceFile:642)

at com.crystaldecisions.reports.formatter.export2.ExportSupervisorEx.a(SourceFile:586)

at com.businessobjects.reports.sdk.requesthandler.ReportViewingRequestHandler.a(SourceFile:636)

at com.businessobjects.reports.sdk.requesthandler.ReportViewingRequestHandler.int(SourceFile:672)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter.do(SourceFile:1944)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(SourceFile:661)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(SourceFile:167)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.a(SourceFile:529)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.call(SourceFile:527)

at com.crystaldecisions.reports.common.ThreadGuard.syncExecute(SourceFile:102)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter.for(SourceFile:525)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter.int(SourceFile:424)

at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(SourceFile:352)

at com.businessobjects.sdk.erom.jrc.a.a(SourceFile:54)

at com.businessobjects.sdk.erom.jrc.a.execute(SourceFile:67)

at com.crystaldecisions.proxy.remoteagent.RemoteAgent$a.execute(SourceFile:716)

at com.crystaldecisions.proxy.remoteagent.CommunicationChannel.a(SourceFile:125)

at com.crystaldecisions.proxy.remoteagent.RemoteAgent.a(SourceFile:537)

at com.crystaldecisions.sdk.occa.report.application.ds.a(SourceFile:186)

at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(SourceFile:1558)

at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(SourceFile:337)

at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.if(SourceFile:223)

... 5 more

<br><br>

Thank you for your help.

Edited by: kakol64 on Apr 23, 2010 2:05 PM

Edited by: kakol64 on Apr 23, 2010 2:05 PM

Edited by: kakol64 on May 5, 2010 2:32 PM

Accepted Solutions (1)

Accepted Solutions (1)

matthew_barrett2
Explorer
0 Kudos

Hi,

I have been having a similar problems in that if you mark a parameter as optional CR4E will prompt the user for the parameter.

If you then use:

crystalReportPageViewer.setEnableParameterPrompt(false);

The CR4E just complains that not all the parameters have been completed. In my mind that is a bug that needs to be fixed.

Anyhow my solution is:

Always add the value for the parameter (add "" for no parameter):

String stringValue = "";
if (uniqueTag)				
	stringValue = new String(sTag);

CRJavaHelper.addDiscreteParameterValue(clientDoc, "", "uniqueTag", stringValue);				

Then in your Crystal Report where ever you use the parameter use something like:

if HasValue({?uniqueTag}) and length({?uniqueTag}) > 0 then
    UCASE({?uniqueTag}) = UCASE({ACTIVITY.SUSPECT})
else
    ISNULL({ACTIVITY.DATERECEIVED});

Hope that helps

Matt.

Answers (1)

Answers (1)

ted_ueda
Employee
Employee
0 Kudos

I would take the CRJavaHelper out of your code, since it's acting to obscure the real API. No value isn't a discrete value.

Would you try something along the lines of:


    Values noValues = new Values();
    noValues.setIsNoValue(true);
    reportClientDoc.getDataDefController().getParameterFieldController().setCurrentValue("", parametre.getNom(), noValues);

and seeing if that works?

Sincerely,

Ted Ueda

Former Member
0 Kudos

Hi,

Thank you much for your help.

Unfortunately, I tried your code but it doesn't work. I have exactly the same error : Programming error, this function should never be called.

Moreover, I use Crystal Report for Eclipse to develop an other application, a Web application this time, and I have the same problem with dynamic optional parameters when they are empty.

Depending on the initial report that I choose on a first page, a second page opens with the parameters to enter for this report.

The problem occures for parameters that are not required when I leave them empty and then I click on ok. I obtain the following error and the viewer does not open:

Error

Programming error, this function should never be Called.

I use the pages viewer_frame.jsp for the parameters and CrystalReportViewer.jsp for the viewer, contained in the plugin For CrystalReport for Eclipse.

The problem appears only with optional parameters which are created by commands in the report that dynamically fill the list of values.

When I enter all the parameters (mandatory and optional) it works perfectly.

Do you have an idea to solve that?

Sincerely,

Carole

ps : sorry if I make mistakes in my English, I'm french.

Edited by: kakol64 on May 6, 2010 4:44 PM

ted_ueda
Employee
Employee
0 Kudos

Ok - so let's focus on the value type handling for that parameter.

I'm assuming you're using an optional parameter in the report itself.

So what happens if you use Crystal Reports function to explicitly prevent evaluation of the no value in the text field where you're using it?

Something along the lines of:


if HasValue({?OptionalParam})
then
     {?OptionalParam}
else
    "No Value"

And use that function rather than the optional parameter directly in the report.

Sincerely,

Ted Ueda

Former Member
0 Kudos

Hi Ted,

I tried to do something like that as you told me but I didn't managed.

When I launch the viewer.jsp that I created with cr4e, it works only if I put static parameters in my report even if they are optional but not if I put dynamic optional parameters. Do you know which value is passed to the viewer if I leave my optional parameter empty?

I really don't know what to do because when I refresh the report directly in Crystal Report it works fine also with dynamic optional parameters. I don't do anything in particular in my web application because I create the viewer with a right click on my report, menu Crystal Report - Create a viewer JSP.

Can you help me please?

Thanks.