Array in Crystal Report
Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=19945
Printed Date: 02 May 2024 at 12:25am
Topic: Array in Crystal Report
Posted By: navuser1
Subject: Array in Crystal Report
Date Posted: 25 Aug 2013 at 9:51pm
Dear Sir,
How to print Array values(index wise) in different Section of a Crystal report ?
Suppose : I have declared a array variable in the Formula Fields and It contains data as given below:`
myArray[1] := 'Google';
myArray[2] := 'MSN';
myArray[3] := 'Bing';
Now I want to print myArray[1] in Header Section
myArray[2] in body and myArray[3] in footer section.
How can I do that ? kindly reply ..
Thank you.
|
Replies:
Posted By: Sastry
Date Posted: 26 Aug 2013 at 1:27am
Hi
You need to declare an array and specify the position or value :
Exaample : To display first value
local stringvar array x:= MakeArray("MSN","Google","Bing");
x[1];
2nd value
local stringvar array x:= MakeArray("MSN","Google","Bing");
x[2];
3rd value
local stringvar array x:= MakeArray("MSN","Google","Bing");
x[3];
------------- Thanks,
Sastry
|
Posted By: navuser1
Date Posted: 26 Aug 2013 at 2:01am
what would be the position/value to print x[1] in the section of the report ?
I have only the formula name to print in the Report layout section, I am not able print my variable like x[1],x[2],etc.
Please reply...
|
Posted By: Sastry
Date Posted: 26 Aug 2013 at 2:51am
Hi
You need to create a fromula for each value to display or you can try :
Formula1
local stringvar array x:= MakeArray("MSN","Google","Bing");
x[1];
Formula2
local stringvar array x:= MakeArray("MSN","Google","Bing");
x[2];
Formula3
local stringvar array x:= MakeArray("MSN","Google","Bing");
x[3];
------------- Thanks,
Sastry
|
Posted By: navuser1
Date Posted: 26 Aug 2013 at 3:00am
Have to create no. of formula on the basis of no. of Array Length?
if 'Yes' then how many formula will I create for a not fixed array length ?
|
Posted By: Sastry
Date Posted: 26 Aug 2013 at 4:35am
hI
Check your initial post, you said you have 3 values and need to print in 3 different sections.. based on your post I have posted my answer.
If you have unlimited values in any filed, you can define array like :
local stringvar array x:= {Customer.Country};
x[1];
and create a loop based on some condition and print your formula according to your logic.
------------- Thanks,
Sastry
|
Posted By: navuser1
Date Posted: 26 Aug 2013 at 7:18am
Thank you sir.
Just validate my understanding please...
It is necessary to crate a separate formula to print array value indexing wise...
|
|