Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Record Selection Using Parameters Post Reply Post New Topic
Author Message
TheITGuyAtWork
Newbie
Newbie
Avatar

Joined: 04 May 2018
Online Status: Offline
Posts: 8
Quote TheITGuyAtWork Replybullet Topic: Record Selection Using Parameters
    Posted: 07 May 2018 at 9:20am
Hi,

I am not sure if I am doing this the correct way or if there is a different approach to this. I have created a report which summarizes inventory by item category.  Instead of having multiple similar reports, I would like to parameterize it so the user can select which report they would like to view.  The report works well if I use the select expert and filter the category using the “Is Like” statement, as I have a number of groups and the statement W?? selects all of the groups that I need.  I am also able to add multiple categories using the same “Is Like” statement.  My issue is that I am having a slight problem translating this to parameters. 
I have created a parameter called ReportSelection and fed it to the select expert using the “Is Like” statement.  I am unable to add multiple items to the same parameter item line.  I have added descriptions to the parameter choices and hidden the selections to the users.  The only lines that seem to work are lines with single items. 
 
I have arranged it as follows:
Value                                    Description
*                                          All Items
CIG, CIGS                             Cigars and Cigarettes
COF, MHS                              Coffee and Misc Hotel Supplies
JC                                         Juice
LIQ, LI3                                Local Liquor and Liquers
W??                                      Wines
 
The only ones that work are All Items, Juice and Wines.  I have tried using single and double quotes to no avail.
 
Is there any way to accomplish this task or am I looking at this the wrong way?
Cheers and thanks in advance.

IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 08 May 2018 at 7:32am
That is true.  You cannot have multiple items in the Value column (unless you expect someone to enter  CIG, CIGS.  I have not tried this, but can you add each item separate with the same description.

CIG     Cigars and Cigarettes
CIGS   Cigars and Cigarettes
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 May 2018 at 8:18am
another idea would be to create another field to convert your combinations into a single 'code'.
//SelectValue
if table.field = 'CIG' then 'CIGS' else
if table.field = 'COF' Then 'MHS' else
if table.field = 'LIQ' Then 'LI3'
else table.field

Use a static parameter that you set your values as you want

All Items as 'ALL'
Cigars and Cigarettes as 'CIGS'
Coffee and Misc Hotel Supplies as MHS
Juice as JC
Local Liquor and Liquers as LI3
Wines as W??

In your select Expert
({?Param} = 'ALL' OR {?Param} IN {@SelectValue})
IP IP Logged
TheITGuyAtWork
Newbie
Newbie
Avatar

Joined: 04 May 2018
Online Status: Offline
Posts: 8
Quote TheITGuyAtWork Replybullet Posted: 08 May 2018 at 8:43am
Hi Kevlray,

Thanks for the response.  I tried your suggestion and the report displays 2 lines with the same parameter when it is called.  Each separate line showing their respective data instead of a combination of both.
IP IP Logged
TheITGuyAtWork
Newbie
Newbie
Avatar

Joined: 04 May 2018
Online Status: Offline
Posts: 8
Quote TheITGuyAtWork Replybullet Posted: 08 May 2018 at 8:52am
Hi Dblank.

I am trying to wrap my head around what you wrote.  The thing is that I want both CIG and CIGS passed in the search.  As well as COF and MHS, and LIQ and LI3 respectively.

If I don't use parameters and I use the select expert, the formula shows up as:

{ICITEM.CATEGORY} like ["CIG", "CIGS"]

There are a number of Categories such as WAG, WCH, WCH, WIT, which were successfully summarized with W??.

I am still trying to digest what you sent.

Cheers.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 May 2018 at 9:30am
Ahh.. wasn't sure what W?? is.
Basically I am suggesting you 'convert' your raw data to the categories that you want them to be via a simple formula field that I called "SelectValue". This allows you to stick two or more distinct items into a 'grouping' of your choice

//SelectValue
if ICITEM.CATEGORY = 'CIG' then 'CIGS' else
if ICITEM.CATEGORY = 'COF' Then 'MHS' else
if ICITEM.CATEGORY = 'LIQ' Then 'LI3'
if ICITEM.CATEGORY like 'W??' then 'WINE'
else ICITEM.CATEGORY

Now that you created a formula field that converts all of your different types into the groupings you want, use the @SelectValue as your selection option, not the original ICITEM.CATEGORY field.
To make it easier for the user selecting options, you can create a static parameter with descriptions of the 'grouped items' and the value per @SelectValue results.
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.035 seconds.