Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Parameter to select multi-value records Post Reply Post New Topic
Author Message
Carol1
Newbie
Newbie
Avatar

Joined: 03 Sep 2020
Location: Australia
Online Status: Offline
Posts: 6
Quote Carol1 Replybullet Topic: Parameter to select multi-value records
    Posted: 07 Feb 2021 at 1:22pm
Hi.
I’m having a problem with parameters and hope that someone can provide me with some advice.
I have a table which includes a column that can have one or several values in it, eg only White or White, Grey and Black. It looks something like this:
PROJECT     COLOUR
1               White
2               Matte White
3               Pearl White
4               Grey
5               Black
6               White, Black
7               White, Grey, Black

I created a parameter for COLOUR. In record selection TABLE.COLOUR ‘is equal to’ my parameter.
When I run the parameter with ‘White’ selected, Crystal will only return records that have only White entered (Project 1) and no other colour, ie I can’t get records 6 and 7 that also have Grey and Black entered.
I don’t want to change the record selection to ‘is like’ because I expect my parameter would also then return records with Matte White and Pearl White.
My aim is for the parameter to return Projects numbered 1, 6 and 7 which all include ‘White’ but may also include other colours.
How do I achieve this, please?

Edited by Carol1 - 07 Feb 2021 at 1:24pm
IP IP Logged
Valert16
Groupie
Groupie
Avatar

Joined: 21 Mar 2016
Location: Spain
Online Status: Offline
Posts: 57
Quote Valert16 Replybullet Posted: 18 Feb 2021 at 5:46am
If field values with multiple colours are always separated by commas, you can use this sentence in Record Selection:
{Table.COLOUR} = {?paramColour} OR ({Table.COLOUR} like "*" & {?paramColour} & "*" and ({Table.COLOUR} like "*,*"))
IP IP Logged
Carol1
Newbie
Newbie
Avatar

Joined: 03 Sep 2020
Location: Australia
Online Status: Offline
Posts: 6
Quote Carol1 Replybullet Posted: 18 Feb 2021 at 10:27am
Yes, Valert16, the values are all separated by a comma. Some minor tweaking to suit my table and the sentence works beautifully. Thank you so much for your help.
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.016 seconds.