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!

Shared Numbervar..please help 1

Status
Not open for further replies.

nattyborneo

Technical User
Feb 1, 2011
29
DE
Dear all Guru....

I have a problem as newbie with Shared Numbervar Crystal Report 8.

I want to put some formula from SubReport to the MainReport.
In Main report, I have several formula with boolean expression result and I use running total fields to have the total; then group them in 2 groups (country code and date). I put the main formula in details (suppressed), the running total fields in group footer 2 (date group), the group 1 (country code) at group header.

I link with the subreport.

and from subreport the same things with the main formula with boolean expression and running total fields to have the total; then group them in 2 groups (country code and date).

one of the example I use in main formula in subreport is formula Pieces:
if (isnull ({Shipment_query.Pieces}) OR ({Shipment_query.Pieces} =0)) then 1 else 0
then I use running total fields to have the total.

the problem...I want to put the formula Pieces from SubReport to the exactly next coulumn in the MainReport.

how to do this? I am really confuse...any help are very appreciate ^^

 
As long as the subreport executes before you display Shared variable they can be same column as RTs.

Split the footer into 2 sections place the Subreport in upper section and then running totals and shared var in lower section.

Ian
 
how to create the shared variables for this formula?
in Main and also SubReport?
Pieces :
if (isnull ({Shipment_query.Pieces}) OR ({Shipment_query.Pieces} =0)) then 1 else 0
 
If you are looking to match at the detail level, it implies a link not only on the two group fields, but also on some key field in the detail section, e.g., itemID or something. You could then display the formula from the sub without using a shared variable. If you need to do calculations with it in the main report, then you would need the shared variable. So what is your final goal--to both display detail level values from the sub and calculate with them?

-LB
 
for details,

I have a main report:

Group 1 header : (Country Code). Result will be US, AU, CN, dll.
Details : (Invoice ) Boolean expression for Invoice with value is less or equal to 0; give 1 if true else 0. Result will be 1 or 0
Group 2 footer : (Running Total per month) Sum of Invoice from Details. Result will be 1345 or.....

Different universe I link using the ID.

I have a SubReport :
Group 1 header : (Country Code). Result will be US, AU, CN, dll.
Details : (Pieces ) Boolean expression for Pieces with value is Null or 0; give 1 if true else 0. Result will be 1 or 0
Group 2 footer : (Running Total per month) Sum of Pieces from Details part. Result will be 56 or.....

I want to put the Pieces from SubReport beside the Invoice in MainReport which are no details (detail suppressed) only the sum of both.

Since I don't have any idea to put the SubReport to the MainReport, please give me advices...and I don't know how to create my logic for Pieces to combine it with Shared Variable. Or there is a possibility to do it without Shared Variable? I don't think so....since they both are different universe.
 
I think you can just suppress all sections of the subreport except the GF2, and assuming you have linked on the country and date group fields, you can place it directly in the GF2 of the main report. Resize it so just the one number shows for Sum of Pieces.

If your group is on date on change of month, you don't want to link the date fields themselves, but instead create a formula in both the main report and subreport and link the two formulas to each other:

date(year({table.date}),month({table.date}),1)

Alternatively, you could link on the date field, but in the subreport, go to report->selection formula->record and change the date part of the selection criteria to:

year({table.date}) = year({?pm-table.date}) and
month({table.date}) = month({?pm-table.date})

-LB
 
Btw, If I may know...

when we supposed to use shared variable? I am not clear at this point...

thx,
Nat
 
You might need one if you want to do a calculation in the main report that uses the subreport value or if you want the shared variable placed in a different section than the subreport. To set up a shared variable, place a formula on the subreport (usually in the report footer), like this:

whileprintingrecords;
shared numbervar totpieces := {#yourrt};

Then in the main report, in a section below the one containing the subreport (could be a "b" section below the "a" section containing the sub), add a formula that references it like this:

whileprintingrecords;
shared numbervar totpieces; //to display the result

Or you can do a calculation like this:

whileprintingrecords;
shared numbervar totpieces;
totpieces*{table.price}

-LB
 
Hi Ibass,

I tried last time with no shared variable and it didn't work.
I tried to use shared variable, it works but the problem how to use the shared variable with running total fields?

I am using date as the filter.
and 2 groups :
one is country code and
the other is date group.

any additional information which needed will be provided to finish this problem...
TGIF, but now I have to finish it....help me please....
Any help would be appreciate.

Thx,
Nat
 
I have already outlined all the steps. You now need to explain in detail how you implemented them. My first suggestion was simply displaying the subreport results without a shared variable. This clearly should have worked.

What do you mean by:
I tried to use shared variable, it works but the problem how to use the shared variable with running total fields?
What are you trying to do with the shared variable?

-LB

 
Ibass,

I tried to put the subreport just exactly what u mentioned without shared variable and then I can't show the subreport in mainreport. I have several coulums in subreport and want to put them in main report with supress all field except GF2 but it didn't come in main report.

I link the ID and the date.
but still doesn't work.

have any suggest?
Thanks,
Nat

 
So no data is appearing in the subreport?

In the main report, is your date field a date or a datetime?

Is your group on date on change of day or some other interval?

Should the dates in the subreport exactly match the ones in the main report or just generally fall within the same period?

Are you using the date in the main report in the selection formula? How?

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top