Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: How to access a list of records using a parameter Post Reply Post New Topic
Author Message
cyber-guys
Groupie
Groupie


Joined: 02 May 2008
Online Status: Offline
Posts: 42
Quote cyber-guys Replybullet Topic: How to access a list of records using a parameter
     Posted: 16 Oct 2013 at 11:46pm
I have a sales report that I want the user to be able to access multiple ticket numbers by entering the ticket numbers as a parameter. (CR XI)the CR multiple value works but it's clunky at best - I'd like to have a single line entry where the ticket numbers can be entered in sequence, ie; 1,2,6,8

I'm guessing this is something that would require an array - any ideas on how to do this?

Thanks in advance,
cyber-guys
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 17 Oct 2013 at 5:01am
well, actually, I have done this years ago, and there is a caveat...I used a stored procedure to transform the string into an table that I could join to.

Thinking of just staying in CR, you could use SPLIT() to turn the string to array of string. You could do this in the report header or the record selection...you could use a shared stringvar array to allow the reuse throughout the report.

Just some ideas, hope they help

IP IP Logged
cyber-guys
Groupie
Groupie


Joined: 02 May 2008
Online Status: Offline
Posts: 42
Quote cyber-guys Replybullet Posted: 18 Oct 2013 at 5:50am
The question I have is how do I use the array to generate the appropriate query.

Thanks,
Cyber-guys
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 18 Oct 2013 at 5:56am
you can't use the array to generate the query.

You can use the array in the Report/Selection Formulas/Record to filter out the records that fit or don't.

I would probably try to start with something like:
local stringvar array x := split({?param}, ",");
{table.field} in x

this would create a string array from the parameter, and then check that a field's value is in the array. If so, it would be included in the report, if not, it would be excluded.

If you pass it a stored proc, you would need to convert the string to a table to filter out the unwanted records.

HTH
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