Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Using shared variables as Array Index Post Reply Post New Topic
Author Message
GowthamSen
Groupie
Groupie


Joined: 03 Jun 2009
Location: India
Online Status: Offline
Posts: 65
Quote GowthamSen Replybullet Topic: Using shared variables as Array Index
     Posted: 25 Jan 2010 at 2:13pm

Hi,

I defined 3 Shared variables in Main Report.
They are numbervar, String Var Array and String Var Array.
 
A sub report is added to a Page header and the shared variables are updated.
 
Now, I created a variable where I am trying to use the shared variables. But the values are not being updated in main report.
 
Am I missing anything here?
 
The variables definitions are as follows.
 
Sub Report -
 
Variable: Array Load
Defintion:
Shared Stringvar array Lbl_Array;
Shared Stringvar array Lbl_Desc_Array;
Shared Numbervar i:=1;
whilePrintingrecords;
Redim Preserve Lbl_Array[recordnumber];
Redim Preserve Lbl_Desc_Array[recordnumber];
Lbl_Desc_Array [recordnumber]:={Command.'XXXCHINESE'};
Lbl_Array [recordnumber]:={Command.LABLE};
 
This variable is placed in Detail section of sub report.
 
Variable: Total Records
Defintion:
Shared NumberVar Total_Recs;
Whileprintingrecords;
Total_Recs:=Total_Recs+1;
 
This variable is placed in Detail section of sub report.
 
The two above variables are working fine.
 
 
Main Report -
 
Varaible : All_Vars
Defintion:
Shared StringVar array Lbl_Array;
Shared StringVar array Lbl_Desc_Array;
Shared NumberVar i:=1;
Shared NumberVar Total_Recs:=0;
 
I placed this variable in Report Header.
 
Variable: Array Display
Defintion:
Shared StringVar array Lbl_Array;
Whileprintingrecords;
Lbl_Array[recordnumber];
 
This is placed id detail section of main report. The values are being displayed correctly.
 
Variable: Test_fn
Definition:
Local NumberVar j;
Shared NumberVar Total_Recs;
Shared StringVar Array Lbl_Array;
Shared StringVar Array Lbl_Desc_Array;
Redim Preserve Lbl_Array[Total_recs];
Redim Preserve Lbl_Desc_Array[Total_recs];
Match_Lbl_Desc ("Plant",Total_Recs, Lbl_Array, Lbl_Desc_Array)
 
Here this variable is showing an error. The variable Total_Recs is coming as 0. And the formula is throughing an error.
 
Am I missing any thing here?
 
Please help me.
 
Thank you,
Regards
 
Gowtham
Thank you
Regards,

Gowtham Sen.
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