Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Array in Crystal Report Post Reply Post New Topic
Author Message
navuser1
Newbie
Newbie


Joined: 19 Aug 2013
Online Status: Offline
Posts: 8
Quote navuser1 Replybullet Topic: Array in Crystal Report
    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.
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet 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
IP IP Logged
navuser1
Newbie
Newbie


Joined: 19 Aug 2013
Online Status: Offline
Posts: 8
Quote navuser1 Replybullet 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...
IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet 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
IP IP Logged
navuser1
Newbie
Newbie


Joined: 19 Aug 2013
Online Status: Offline
Posts: 8
Quote navuser1 Replybullet 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 ?

IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet 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
IP IP Logged
navuser1
Newbie
Newbie


Joined: 19 Aug 2013
Online Status: Offline
Posts: 8
Quote navuser1 Replybullet 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...
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.031 seconds.