Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Shared Array variable Post Reply Post New Topic
Author Message
CUser
Newbie
Newbie
Avatar

Joined: 14 Apr 2010
Location: United States
Online Status: Offline
Posts: 8
Quote CUser Replybullet Topic: Shared Array variable
    Posted: 14 Apr 2010 at 7:14am
Hi,
 
I am alway little poor in the Array usage. I have Shared String Array variable in Sub Report which I would like to Pass to the Main report. Can someone please help?
 
Thanks,
CUser


Edited by CUser - 14 Apr 2010 at 7:15am
CUser
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 15 Apr 2010 at 3:17am
if you have already declared it as shared array in the subreport, after populating it, use the same declaration in the main report ... after the subreport has been run and the values are available for use.
 
HTH
IP IP Logged
CUser
Newbie
Newbie
Avatar

Joined: 14 Apr 2010
Location: United States
Online Status: Offline
Posts: 8
Quote CUser Replybullet Posted: 15 Apr 2010 at 4:34am
Thanks for the response. I have following code in subreport
 
WhilePrintingRecords;
shared stringvar Array labelquest;
numbervar i:=1;
Redim labelquest[3];
if  condition 1 then
     labelquest[1] := 'condition'
else if condition 2 then
      labelquest[2] := 'condition'
else if condition 3 then
      labelquest[3] := 'condition';
For i := 1 to 3 Do
(
   labelquest = labelquest
);
labelquest[1] + ' ' + labelquest[2] + ' ' + labelquest[3]
 
I don't think I have written above syntax in most correct manner (suggestion are always welcome)
 
It display the database value in subreport and I have following code in my main report after the subreport
 
WhilePrintingRecords;
shared stringvar Array labelquest;
ReDim labelquest[3];
labelquest[1] + ','+ labelquest[2] + ','+labelquest[3]
 
and I am not getting any value in the main report..
 
Help me what am I doing wrong..
CUser
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 15 Apr 2010 at 8:26am
when you redim, you erase the array.  You don't need to redim it in the main report, just access the members of the array.
 
HTH
IP IP Logged
CUser
Newbie
Newbie
Avatar

Joined: 14 Apr 2010
Location: United States
Online Status: Offline
Posts: 8
Quote CUser Replybullet Posted: 15 Apr 2010 at 8:52am
Thanks again..
 
I realized the redim keywork so my code now reads
 
WhilePrintingRecords;
shared stringvar Array labelquest;
labelquest[1] + ','+ labelquest[2] + ','+ labelquest[3]
 
My first two label values getting overwritten by the third label, so I am getting same label three times. and if I try to make it as drilldown I get the 'subscript must be between 1 and the size of the array.'
 
Sorry to bother.. but I am totally lost.
CUser
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 15 Apr 2010 at 9:31am
For i := 1 to 3 Do
(
   labelquest = labelquest
);
 
I don't think that this code is needed at all.  You have already assigned the value, and you aren't assigning as the syntax for that would be :=.
 
and you probably want to break this into 3 if statements, as only 1 gets a value:
if  condition 1 then
     labelquest[1] := 'condition'
else if condition 2 then
      labelquest[2] := 'condition'
else if condition 3 then
      labelquest[3] := 'condition';
 
HTH
IP IP Logged
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.047 seconds.