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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

advanced subreport question.... 1

Status
Not open for further replies.

uksub

Programmer
Jun 15, 2003
51
US
example:

Main Report Sub report
employee file -------------------
--------------- employeeAddressfile
Id Id

the books show that you can reference "employeeAddressfile" as subreport of the main report using Id and the key.

my problem is this:

Main Report Sub report
employee file employee file
--------------- -------------------


i'm attempting to read and display the same data again (although in a slightly different format) in the sub report, but from the same file.

now it seems to work as unlinked, but you have to put in the same parameters as the main report for the sub report.

it does'nt seem to work when i try to link the two... because i don't want the users to have to put in the 2 sets of the same parameters.

any suggestions?


 
Rather than providing visual similes and text descriptions, you'll be better served to post table layouts (at least the relevent fields), example data and expected output. You may not require a subreport at all.

To join a subreport to a main report, choose the parameters from the main report and link them to the fields in the subreport, you don't need parameters in the subreport if they're the same parameters.

-k
 
yea but the problem is if i'm tryin to link back to the same file in the subreport that the main report is using... its that kind of a recursive problem. i.e employee.ID linking back to employee.ID.

i've never seen that done in the examples. its usually linking two different files... i.e. employee.ID to employee_address.Id.


if i want to link back to the same file.. should i make an alias of the file in the subreport.


i.e.

employee.ID ---> employee_alias.ID

is this possible.

i would try to send more detailed information but i'm working as a contractor and i have trouble gettin access. sorry for inconvience.

 
It's possible to use the same datasource both in the main and subreports. This kind of thing is done all the time in programming, and is called a pig's ear or self join.

You can do this in the same report without using a subreport, as long as you alias the 2nd instance of the datasource with an alias - like your example at the end of your last post.

If you do choose to use a subreport, an alias name isn't necessary. The linking strategy, however, is exactly the same as if the report was using a different datasource than the main report. From your post, it sounds as if it's bad linking that is your problem. Ensure that you use the little scroll bar on the "Subreport parameter to use" window to ensure that you link to the actual matching parameter name, rather than the parameter name prefixed with "?Pm-".

Naith
 
thanx Naith.... that really helped. it solved the problem!! i was linking to the "?Pm-" field instead of the matching parameter. thanx again. :-D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top