Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Report Design
Message Icon Topic: Referencing a parameter with multiple values Post Reply Post New Topic
Author Message
Tim Wise
Newbie
Newbie
Avatar

Joined: 29 Apr 2008
Location: United States
Online Status: Offline
Posts: 31
Quote Tim Wise Replybullet Topic: Referencing a parameter with multiple values
    Posted: 02 Jun 2008 at 3:58pm
I have a string parameter that has multiple values. How do I reference the list of values in a formula? Currently, I'm only seeing the first value in the list/string.
 
I'd like to use a parameter to form a record selection like
 
{HYP_GLOBAL_SYSTEM_VIEW.HOST} like ["hyp*", "mx*"]
 
where the list ["hyp*", "mx*"] is filled via a parameter.
 
Any pointers are appreciated.
 
PS: I'm using CR 2008.


Edited by Tim Wise - 02 Jun 2008 at 3:58pm
--
Tim
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 02 Jun 2008 at 5:17pm
I'm not sure if you can accomplish what you want to do. It looks like you are trying to do two things at once.

First off, you are asking about using a multi-valued parameter. This is perfectly easy to do in CR. Create the parameter and in the options at the bottom of the dialog box, enable multiple values. The user can enter as many strings as they like.

However, in this question it appears that you want to use the string values to perform filtering on the database. In CR, you would use a mult-value parameter to do exact string matches using the IN operator: {VIEW.HOST} IN {?ParameterName}

But the IN operator doesn't support wild-cards. It can only do exact string matches. I was trying to think of away to trick CR into doing this using string manipulation, but I'm not coming up with anything. Thus, I really don't think it's possible at all.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Tim Wise
Newbie
Newbie
Avatar

Joined: 29 Apr 2008
Location: United States
Online Status: Offline
Posts: 31
Quote Tim Wise Replybullet Posted: 02 Jun 2008 at 7:42pm
In CR, you would use a mult-value parameter to do exact string matches using the IN operator: {VIEW.HOST} IN {?ParameterName}
Yep, that works.  
 
I wasn't clear of the type of a multi-valued parameter and how it expanded when used. It turns out that a multi-valued parameter is an array of strings. These are both string arrays:
 
["hdmcjunapp1", "hyp-app"]
["*app*", "mx*"]

Either can be used in a record selection formula:
 
{VIEW.HOST} in {?ParameterName}
{VIEW.HOST} like {?pHostName}
 
IN will do exact mathes; LIKE will match simple patterns. CR translate the LIKE into this:
 
WHERE  ("VIEW"."HOST" LIKE '%app%' OR "VIEW"."HOST" LIKE 'mx%')
 
I'm letting users enter patterns by setting the 'Allow custom values' property of the parameter to true.
 
Thanks for the help!
 
PS: Why does the font of my post get small and turn blue? :-)


Edited by Tim Wise - 02 Jun 2008 at 7:42pm
--
Tim
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 02 Jun 2008 at 8:25pm
You tested LIKE and this works for a string array? Nice. I had no idea. I'll make a note of it for future reference.

Why is your font blue? I was wondering the same thing myself.  I see this on the forum every now and then and just figured that the user clicked the font button or something. Don't know, it's a packed forum app that I downloaded.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
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.