Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: How to pass shared array variable to main report Post Reply Post New Topic
Author Message
HeidisMom
Newbie
Newbie


Joined: 25 Jun 2012
Online Status: Offline
Posts: 2
Quote HeidisMom Replybullet Topic: How to pass shared array variable to main report
     Posted: 09 Jul 2012 at 12:19pm
I'm new to Crystal Report and I can't figure out how to pass a shared array variable to my main report from a subreport.   (Please let me know if I have created my array variable in my subreport wrong since I'm kind of guessing).
 
In the subreport I have created a formula to initialize the array and load it...
Formula/Variable: Vendor_Load
shared stringvar array vendor_load;
shared numbervar i:=1;
whileprintingrecords;
Redim preserve vendor_load[recordnumber];
vendor_load[recordnumber] := {VENDOR.Vendor_Name}
 
I placed this variable in the detail section of the report
Then I created another formula/variable to print the variable
Formula/Variable: Vendor_Print
Shared stringVar array vendor_load;
WhilePrintingRecords;
Join (vendor_load, ", ")
 
I had to place this in the report footer in order for my entire list to show up.
 
Now all I want to do is pass the list of vendor names to my main report.... but I'm not sure how to do that. It seems to be different than just passing a single variable.
 
I placed this in the detail section and report footer and 0 is diplayed in my main report....
Main Variable: Vendor_Print
shared stringVar array Vendor_Load;
whileprintingrecords;
 
What am I doing wrong?  Wacko Any help is much appreciated -  Thanks!
 
 
 
 
 
 
 
 


Edited by HeidisMom - 09 Jul 2012 at 12:20pm
IP IP Logged
HeidisMom
Newbie
Newbie


Joined: 25 Jun 2012
Online Status: Offline
Posts: 2
Quote HeidisMom Replybullet Posted: 09 Jul 2012 at 5:43pm

Any help at all would be greatly appreciated.... even links to other resources I could read would be helpful although I have googled and googled and googled....

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 11 Jul 2012 at 3:39am
you don't so much 'pass' the value, but the method is really easy...
 
in your subreport you have a line like:
shared numbervar x; //or whatever type you want
x:=something;         //assign the variable a value
 
 
that's it for declaring and passing and assigning, now how do we get the main report to use it...
 
in the main report you have a line like:
shared numbervar x;     //all done, now just use x...
if x > 10 then
  //do something
 
HTH
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