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

shared variable from subreport detail section

Status
Not open for further replies.

BlurredVision

Technical User
Aug 6, 2001
326
GB
Hello all,

I created a simple report

Within my main report I have the detail section split up into two sections (A and B)

In section A I have a subreport which returns a shared variable:
shared stringvar num := {RV_Practitioner_ID_Numbers.ID_Number};
num;

In section B I have a formula to return the shared variable:
shared stringvar num;
num;

My problem is, the formula in section B only returns the last value - Any ideas on why this is?

I am running v10 of CR

Thanks....
 
The last value of what?

Is the subreport linked to the main report?

It's generally best to state what you want rather than what you do not.

-k
 
BlurredVision,

I am going to maek the assumption that your variable is in the details (or another section of which there is multiple occurances).

If this is the case, the variable is set the first time, then assigned a new value on the new record, and so on and so forth, therefore the last record in the subreport would be the last time a value is assigned to your variable.

If this is not the case of what thje structure of your report looks like, please let me know.

Hope this helps,



Mike
______________________________________________________________
[banghead] "It Seems All My Problems Exist Between Keyboard and Chair"
 
Sorry, it displays the last item of the section A detail from the sub report.

I want it to display each each of the sub report records on each line.. I need to export subreport information to excel (data only)
 
I have a main report and the subreport. The details of the subreport are totalled in a grouping. This grouping is linked to the main report. I am displaying through the use of a shared variable teh value of each group. This works great.

Now I need to display the grand total from the subreport on the main report. Like the person said above, the only thing I see is the last value. Any ideas?
 
Make sure you have the Can Grow turned on for the subreport (default).

A subreport will display all rows in the details section of a main report, so the issue is in your implementation.

You ignored the question of if it is linked, that's probably the key.

-k
 
Thanks for all the replies..

I have the sub report linked to the main report and my shared variable and sub report are set to grow.

Maybe I'm missing something -

With my sub report in the detail section of A (with the formula defining the shared variable in it) and my shared variable formula in the main report in detal section B, I thought that each time that the subreport returned a row, it would also return a row within the main report with using the shared variable formula that I created. Am I wrong?

 
Yes, but you have to have the subreport linked to the main report on a field that is unique to each row.

jtgolf30, please start a new thread.

-LB
 
Ok.. That would be my problem then.. field that I am using to link the subreport to the main report is not unique, nor do I have a unique field available to link on. Is there a work around for this?
 
There's probably a way, but we really don't know what you are trying to do here. Please show us what you expect the subreport to do by providing some sample data where you indicate the report sections and the subreport, the fields you are using, etc.

-LB
 
Ok..

In my main report i display a field called pract_id, within the main report I have two sub reports.. One pulls a field called id_number the other sub report calls univ_id. The main report is grouped by the pract_id and the sub reports are within the group footers - The data looks like this:

GH #1(pract_id) - Surpressed
Details - Surpressed
GF #1(pract_id) The footer holds the pract_id and two sub reports - When generated, it looks like this

Pract_ID id_number univ_id
1223 29083 0293
20992 9033
20094 0021
05482 2032
09212 2022

My goal is to be able to export this information to excel (data only) But because subreports are considered their own objects, they are not export properly (placed on their own line)
 
Actually you can export the subreport data so that each field appears on its own line. Try using the regular Excel export instead of data only. Make sure that the field and the two subreports are the same height by selecting them all ->format objects->make same size->height, and also make sure they each are connected to gridlines on left, right, top, and bottom.

-LB
 
That was one of the solutions I gave him, but the customer didn't care for it... I ended up using array's to collect all the information and passed that to a sub report. Added another formula within the subreport to generate record numbers for each row and surpressed everything in the main report.. this allowed me to export the info to excel (data only) It was a crazy amount of work for a silly task.

Thanks for everyone's help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top