Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: can we use shared variable in main report's crosst Post Reply Post New Topic
Author Message
sangi
Newbie
Newbie


Joined: 25 Mar 2008
Location: India
Online Status: Offline
Posts: 3
Quote sangi Replybullet Topic: can we use shared variable in main report's crosst
     Posted: 25 Mar 2008 at 4:10am
Hi,

I have a report with subreport (in Group footer), crosstab (in Group header).

For cross tab calculation, I need a value from subreport to be passed to main report.

I could pass the value.. but since the crosstab is in group header , I am not able to get the values .. .it is all 0....

Please help me ...
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 25 Mar 2008 at 9:40pm
This is actually very complicated. I cover the topic in detail in Chapter 13 of my book and I also posted very helpful comments on this forum. Search the forum for GridRowColumnValue. Those posts will give you a lot of information about accessing the data in the crosstab and you'll have to save this data to a Shared variable so that the main report can print the data.

You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.

Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
sangi
Newbie
Newbie


Joined: 25 Mar 2008
Location: India
Online Status: Offline
Posts: 3
Quote sangi Replybullet Posted: 25 Mar 2008 at 11:09pm
Hi Brian,

Thanks for the reply.. I am getting the book today...

Meanwhile, Let me put my query clear enough...

I am not getting any value from cross tab...

I have to pass the value to main report from sub report and that should be used in cross tab...

Here goes my formula,

In sub report I have
shared numbervar cnt:=count((id),@lgroup)
I put this in group header section of sub report

In the mainreport I have
shared numbervar cnt;
cnt

I put this formula in the main report section where I placed my sub report...

I can get the values passed to my main report...

But when i include it in the cross tab (which is in main report group header), I am getting all group count as 0 ...

I hope it is bcoz subreport gets evaluated after the group header... so the value is 0.. Is there any workaround for this ?

IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 25 Mar 2008 at 11:51pm
Subreports always get evaluated as the last item in a section. All other formulas are calculated first (regardless of where the subreport appears in the section).

The way to get around this is to add a second section (Group Header #1b for example). Put the subreport in its own section and make sure that  the formulas that need to get the value from the subreport are located in the section AFTER the section that prints the subreport.  That should get you going.

I discuss this topic on page 372 called "Troubleshooting Shared Variables". You can find out more about my books at Amazon.com or reading the Crystal Reports eBooks online.

Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum