Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Add date shared variable as parameter Post Reply Post New Topic
<< Prev Page  of 4 Next >>
Author Message
pto160
Newbie
Newbie


Joined: 13 May 2009
Location: United States
Online Status: Offline
Posts: 16
Quote pto160 Replybullet Posted: 15 May 2009 at 5:51pm
I followed your advice and added the values from the shared variable to the main report and it is displaying correctly. I added a section below the subreport. How do I add the shared variable in the main report as a parameter? Do parameters only work with fields in the database? If I can get this, this will save tonnes of paper.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 18 May 2009 at 6:43am
I'm not sure, as I no longer use the parameters in the reports, I just pass the desired dataset to the report to display.
 
You should be able to set the shared variable to a parameter.  I would try a formula that assigned the parameter to the shared variable and place this new formula in the report header.  something like:
 
shared numbervar whatIwant := @parameter;
""   //to hide the assignment value
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 20 May 2009 at 6:08pm
Debmac posted this nice link for another question that should resolve your issue on using one parameter in the main report for all of your sub reports...
http://www.tek-tips.com/faqs.cfm?fid=1329
IP IP Logged
pto160
Newbie
Newbie


Joined: 13 May 2009
Location: United States
Online Status: Offline
Posts: 16
Quote pto160 Replybullet Posted: 21 May 2009 at 7:13am
Thanks. The shared date variable is in the subreport (Called shipped qty) because it is pulling most of the information from other formulas in the subreport that use the Sales table. It is pulling the net stock from the main report. It is not a table date field in the database.

Is there a way to pass the shared date variable as a record selection based on a parameter even though it is not a field in the database?
I have been told that I may need to use conditional suppressing to make this work.
I can use rapidshare.com to send the file if need be.

 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 21 May 2009 at 7:32am
I'm sure what you mean by passing a shared date variable as a record selection.
 
shared is shared, it has access to all parts of the report.  if you want to use it to select records for a stored proc or subreport, then I would create a formula that just 'displays' the shared variable and then use it in the linking of the subreport to the parameter that needs it.
 
I don't know if this work, but it is what I would try first...this is setting the parameter of the subreport to the value that you want.  I can't see why this wouldn't work, but Crystal has quirks, and I just might not have come across this one, yet.
IP IP Logged
pto160
Newbie
Newbie


Joined: 13 May 2009
Location: United States
Online Status: Offline
Posts: 16
Quote pto160 Replybullet Posted: 21 May 2009 at 12:57pm
Thanks. Would I create the formula that just 'displays' the shared variable in  the subreport or the main report?

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 21 May 2009 at 1:13pm
in the main report so that you can use it to link to the parameter in the subreport.
IP IP Logged
pto160
Newbie
Newbie


Joined: 13 May 2009
Location: United States
Online Status: Offline
Posts: 16
Quote pto160 Replybullet Posted: 21 May 2009 at 3:56pm
And in the subreport I would put
shared numbervar whatIwant := @parameter;
""   //to hide the assignment value.
 and then use subreport links to link the main report and the subreport?

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 22 May 2009 at 6:24am
I don't think so.  the subreport is gathering some data from the database.  It is usually gathering this information based on some criteria.  I thought that a part of the criteria was the value in the shared variable.  Either way, the subreport is 'Linked' to the main report via the parameters.  Right click on the subreport from the main report and choose 'Change Links' or something like that.  I would attempt to link the formula in the main report to the appropriate parameter in the subreport.
 

Does this make sense?
 
IP IP Logged
pto160
Newbie
Newbie


Joined: 13 May 2009
Location: United States
Online Status: Offline
Posts: 16
Quote pto160 Replybullet Posted: 22 May 2009 at 8:08am
Thanks. Yes, I am basing it on a shared variable in the subreport.
Okay to summarize. I displayed the shared variable in the main report using a shared variable called Return Date (Out of stock date), which is displaying the correct date. I created a parameter in the subreport called Out_Of_Stock_Date and linked it to the Return Date formula in the main report using change subreport links.
So, how would I create the parameter so the user puts in the Out of Stock Date? I take it I need to create a parameter called Out_of_Stock_Date in the main report?

IP IP Logged
<< Prev Page  of 4 Next >>
Post Reply Post New Topic
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



This page was generated in 0.000 seconds.