Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Populate Array with Parameter Field Post Reply Post New Topic
Author Message
Sven
Newbie
Newbie


Joined: 28 Mar 2008
Online Status: Offline
Posts: 12
Quote Sven Replybullet Topic: Populate Array with Parameter Field
     Posted: 18 Jul 2008 at 11:46am
Hello
 
I have a difficult task regarding displaying parameter fields with multiple values. I like to display all values on the report. Maybe anyone has an idea?! would be great!!
 
Here is a detailed description:
 
When my report starts the user can select which states to display. This is done by a parameter field where the user can select multiple values. If I put the parameter field on the report, just one value is shown.
 
To solve the problem, I have used an array. Here is the code
 
Name of Fomula: DeclareArray
 
WhilePrintingRecords;
Global stringVar array My_Array;
Global numberVar N:=distinctcount({? State});
Redim My_Array[N];
Global numberVar ncounter:=0;
 
I have put this formula in the report header
 
The next formula I have declared is:
 
Name of Fomula: DisplayArray
 
WhilePrintingRecords;
Global numberVar ncounter;
Global stringVar array My_Array;
Global numberVar N;
If ncounter < N Then (ncounter:= ncounter + 1;
    My_Array[ncounter]:={? State};)
 
However, if I check the formula I get the following error message:
 
"This array must be subscribed. For example array"
 
I plan to put this formula into the details section. The array will be show with:
 
Name of formula: PopulateArray
 
WhilePrintingRecords;
Global stringVar array My_Array;
"States: " + Join(My_Array,", ")
I will put this formula in the report footer.
 
 
My question: Does anyone know what the error message means?
 
Any hints and ideas regarding error message or how to approach the problem are more then welcome Smile
 
Cheers
Sven
 


Edited by Sven - 18 Jul 2008 at 11:48am
Keep trying :)
IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 19 Jul 2008 at 1:16pm
Hi ,
 
Use join({?ParameterField}, ',') and place in the report header
 
Cheers
Rahul
IP IP Logged
Sven
Newbie
Newbie


Joined: 28 Mar 2008
Online Status: Offline
Posts: 12
Quote Sven Replybullet Posted: 21 Jul 2008 at 5:31am
Brilliant, is work perfect!
 
Many thanks to Rahul!!!
 
Sven
Keep trying :)
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