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?
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 "*,*"))
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.
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