cancel
Showing results for 
Search instead for 
Did you mean: 

Why won't command in subreport accept linked parameters?

Former Member
0 Kudos

Any suggestions as to why I'm getting an error when I try to use the linked parameters in the subreport command?  (see screenshots). Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

Hi JC,

I'm not too sure what you're trying to do here but if you're trying to link a field from the Main Report to a parameter in the Subreport then the parameter needs to be available in the Subreport's source/report.

I see that you're trying to add a SQL Query to the Subreport however, you haven't created a parameter in the Command Window. Click the 'Create' button and create a prompt with the same Datatype as the field on the Main Report.

This way, the drop-down for 'Subreport parameter field to use', should list the prompt inside the Subreport.

-Abhilash

Former Member
0 Kudos

Thanks for the suggestions    From the main report (see screenshot), I group my data based on Group 1: Department

Group 2: Contact Date

Group 3:  Measure

In Group 2 footer, I place the subreport and intend to pass Department and Contact Date and use it in the subreport command.

In the subreport command (see screenshot), I attempted this code and it's not working

set {?p_contact_date} = {?Pm-Command.CONTACT_DATE}

set {?p_dep } =  {?Pm-Command.DEPARTMENT_ID}

select  {?p_contact_date} ,  {?p_dep }

I wish there was some way to access the values of the linked parameters directly in the command like this

select  {?Pm-Command.CONTACT_DATE}, {?Pm-Command.DEPARTMENT_ID}

Any suggestions? Thanks in advance!

DellSC
Active Contributor
0 Kudos

You CANNOT use the "pm_" parameters in the command unless you actually create them with that name in the command editor BEFORE you create them in the Subreport Links.  Commands CANNOT access parameters that are create outside of the Command Editor.

See my instructions above - create parameters with any name in the command editor and then set up the subreport links to link to those parameter names INSTEAD of the default "pm_" parameter names.

-Dell

Former Member
0 Kudos

Thanks for your help. This step leaves me confused:

c.  In the parameter fields drop-down list, select the appropriate parameter that you created in the Command Editor.

Within the sub-report, I created parameters in the command p_dep and p_contact_date (see screenshot).

Should the p_dep and p_contact_date parameters be available in the Change Subreport Links dialog box?

And why are the subreport parameters showing up when I run the main report?

Thanks, Jeannie

DellSC
Active Contributor
0 Kudos

If the data type of the parameter matches the data type of the selected field in the subreport links dialog, then yes, it will appear in the parameter drop-down.  However, you may have to do this to make that happen:

1. Remove ALL of the fields from the subreport links.

2. Click on OK.

3. Save the report.

4. Re-open the Subreport Links dialog

5. Re-select the fields that you want to link on and link them to the parameters from the Command Editor.

-Dell

Answers (1)

Answers (1)

DellSC
Active Contributor
0 Kudos

Parameters for commands have to be created in the Command Editor - there are internal properties in the parameters that aren't there when you try to get to parameters created in the report/subreport outside of the Command Editor.  So, here's what you need to do:

1.  Create and use the parameters in the Command Editor.  This must be done before setting the links.

2.  In the Subreport Links screen,

  a.  Select the field you want to link on.

  b.  UNCHECK "Select data in subreport based on field".

  c.  In the parameter fields drop-down list, select the appropriate parameter that you created in the Command Editor.

This will link the field from the main report to the parameter in the command.

-Dell