Wednesday, March 21, 2012

Problem passing parameters to sub report

Hi,

I'm hoping this will be an easy one for you gurus:

I have a report with 2 groups and a detail line. I have put a sub report in the group1 footer. Now I can pass the main reports parameters down to the sub-report no problems. The problem I have is that I coded an "All" option into the reps parameter, so that I can report on (for example) all reps sales rather than just one.

Problem is that I need each groups rep ID passed down to the sub report. If I pass the All parameter, the report gives me all reps results in the group footer of each rep. I have tried passing the reportitems!txtrepid.value (the text field holding the repID value in the report) to the sub report, but that doesn't work.

Any ideas?

I also tried using fields!repid.value - I just get "sub report cannot be displayed". If I change it back to use a report parameter, it works - but does not give me what I need.

Any ideas anyone?

|||

Sussed it.

The sub report was looking for a string parameter 3 chars long. The field on the table that I was querying was 15 chars long - therefore it was being padded out with spaces - this made my sub report fail.

I used a LTRIM(RTRIM(S.SlPrsnId)) in my SQL, and low and behold it works!!

No comments:

Post a Comment