0

I've created master report and I am adding a subreport which uses "Web Service DataSource" according the documentation. I am struggling with the following instructions :

In the subreport configuration (or the dataset) specify not to use any connection at all (leave blank both the connection expression and the datasource expression. The only thing we'll have to do is passing some mandatory parameters for internal webservice datasource to work properly :

  • uriKey
  • authTypeKey
  • authParametersKey
  • languageKey
  • verbKey

I've mapped parameters of the master report and the subreport.

uthParametersKey, languageKey, verbKey are java.lang.Object. So, what should I write to the "Default Value Expression"?

enter image description here

Here is my source relating to parameters:

<parameter name="authTypeKey" class="java.lang.String">
    <defaultValueExpression><![CDATA["none"]]></defaultValueExpression>
</parameter>
<parameter name="authParametersKey" class="java.lang.Object" isForPrompting="false"/>
<parameter name="languageKey" class="java.lang.Object">
    <defaultValueExpression><![CDATA["xml"]]></defaultValueExpression>
</parameter>
<parameter name="verbKey" class="java.lang.Object">
    <parameterDescription><![CDATA[]]></parameterDescription>
    <defaultValueExpression><![CDATA["get"]]></defaultValueExpression>
</parameter>
<parameter name="Request" class="java.lang.String">
    <defaultValueExpression><![CDATA["<id>12</id>"]]></defaultValueExpression>
</parameter>
Alex K
  • 22,315
  • 19
  • 108
  • 236
  • 1
    The default value expression, is what value the parameter will have if it is not passed (hence often only used in debug mode), hence you do not need to set it or you can set it to some default value to test your report without passing parameters – Petter Friberg Aug 16 '16 at 10:50

2 Answers2

0

Those parameters are Strings, no Objects. Also, since those are being filled from the main report, you don't need any default values since you want the values from the main report in your subreport.

EDIT

Those parameters are specific types of objects, not all Strings as I thought earlier. From the docs:

You can also pass directly the whole parametersMap for your convenience.

So this can also be a possible way. Again, you don't need default values.

tobi6
  • 8,033
  • 6
  • 26
  • 41
  • I'm afraid it is java.lang.Object. And I need to pass them somehow. I checked these parameters as "Is For prompting" for brevity, but since verbKey and languageKey are java.lang.Object, I cannot fill it. If I Defail Value for them like "get", "xml" (it is what i need to pass), an error is occured: "...java.lang.String cannot be cast to com.jaspersoft.webservice.data.enumerations.LanguageType" – Semuka Alex Aug 16 '16 at 11:37
0

example pass parametres to subreport in jrxml code :

<subreport>
<reportElement positionType="Float" x="0" y="0" width="555" height="1" isRemoveLineWhenBlank="true"/>
<subreportParameter name="paramInSuberport">
<subreportParameterExpression><![CDATA[$P{param}]]></subreportParameterExpression>
</subreportParameter>
<dataSourceExpression><![CDATA[yourDataSource()]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "subreportFile.jasper"]]></subreportExpression>
</subreport>
Piotr Rogowski
  • 3,642
  • 19
  • 24