Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Has anyone tried?

Status
Not open for further replies.

Lhuffst

Programmer
Jun 23, 2003
503
0
0
US
In XI, has anyone successfuly passed a array stringvar to a subreport?

The main report has a parameter that pulls users from a table (oracle). I want to pass that value to the subreport without having to set up a link. Is this possible? I've read articles about passing to a stored procedure but I dont' need that, I just want to pass the value and use it in the record selection criteria.

The reason I am trying to stay away from more subreport links is because java thinks that I have multiple parameters and asks for the information twice.

What I tried was
In mainreport:
?employee where it lists employees in the oracle table

@empVariable
//get the values that were selected on the prompt and pass to subreport
Local NumberVar i;
//Local StringVar temp; original code
shared StringVar temp;
Local NumberVar ArrayLength;
ArrayLength := UBound ({?Employee});
For i := 1 To ArrayLength Do
(
temp := temp + {?Employee}
);
temp


In subreport:
record selection criteria
{Command.PROCESSDATE} >= {?Start Date} and //Data must be between these dates
{Command.PROCESSDATE} <= {?End Date}
and
Not IsNull({@EmpName}) //no blank employees
and
{Command.LASTNAME} in temp


It doesn't recognize temp even though I have it as a shared value.

Also, what I was trying to allow for on the {Command.LASTNAME} in temp line was to capture all the names selected if the user selected more than 1 person.

The error that I get is that a number, boolean, or string is expected on {Command.LASTNAME} in temp

Basically the subreport is generating totals for the entire time period for each person selected and everyone if all is selected on the ?employee prompt. The main report breaks it down by month.


Any guidance would be appreciated.
thanks much
lhuffst

 
Hi,
if ?employee is the multi-value parameter, it is already an Array so you need not create another one..
Instead try something like this:
Create a Shared StringVar EmpList:
Code:
If UBound {{?employee}) > 1 then
Join([?employee},',')
Else
{?employee[1];
EmpList;
and try passing that to the sub for your IN value.


[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Turkbear -- that worked part of the way. I can now see the string being passed (had the wrong scope on the subreport) but it is only taking the first value in the record selection. You got me started so I will try on my own for bit. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top