Print Page | Close Window

Dynamic Value List for Parameter Values

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=3764
Printed Date: 03 May 2024 at 10:33pm


Topic: Dynamic Value List for Parameter Values
Posted By: sengle
Subject: Dynamic Value List for Parameter Values
Date Posted: 21 Jul 2008 at 2:44pm
SmileThis is new to me so need help.  I usually use a static 'List of Values' for my reports.  This time, I am needing to use a dynamic 'List of Values'  but I need to also have an option that will select 'ALL' if the use doesn't select a value from the list.  I know how to do it using a static 'List of Values' by adding the option to the pick list of "ALL" and then test that in the code if they selected the 'ALL.
Anyone know how to do it with the dynamic 'List of Values'?  I can't add the 'ALL' to the list since it is coming from a database table.
 
Thanks so much in advance!



Replies:
Posted By: rahulwalawalkar
Date Posted: 22 Jul 2008 at 3:55am

Hi,

In you report create a separate command object and with the code below
 
Select  '...ALL' as fieldname
from TableName
union
Select fieldname     
from TableName
 
When selecting the parameter dynamic field select the one from command object
 
 
Cheers
Rahul


Posted By: sengle
Date Posted: 23 Jul 2008 at 1:09pm
Rahul,

Thanks for the information.  Really helped but something is not working.

I created a new command object using this code.

select '...ALL' as NAME_LAST_FIRST_MIDDLE
from sbs_reports_reg_style_v
UNION
select Name_Last_First_Middle
from sbs_reports_reg_style_v

 

I then created a new parameter field called ‘Person’, dynamic and used the new command object that had the one field “NAME_LAST_MIDDLE” listed to select to populate the dropdown.

 

In the select expert I added this code:

{Command.NAME_LAST_FIRST_MIDDLE} = {?Person}

 

When I run the report, the selection box comes up with the proper list of names and the choice of ‘…ALL’. This is great.

 

But when I select a person, the report starts reading the data and never selects a record. I have to stop the report as it keeps going and going.

 

Before I changed the parameter to use the command object and only use the table field it worked.

 

What am I missing?



Posted By: rahulwalawalkar
Date Posted: 23 Jul 2008 at 1:37pm

Hi,

In record selection formula

use the code below

if {?Person} = '...ALL' then
true
else
{COMMAND.NAME_LAST_FIRST_MIDDLE} = {?Person}

 
Let me know ....
 
cheers
Rahul


Posted By: sengle
Date Posted: 23 Jul 2008 at 2:02pm

Rahul,

I have already tried that but tried to simplify it even more with out the if/else.

I copied and pasted your code and it doesn't work either.  I am not choosing the '...ALL' as I am trying to select a person from the list just to see if I can get that working first.  The '...ALL' does the same thing - just going through the records but not selecting anything at which point I have to stop the report.

 
Thanks,


Posted By: rahulwalawalkar
Date Posted: 24 Jul 2008 at 1:44am
Hi,
 
Try comparing your {table.fieldname} with the {?person} parameter in the else part and  {?person} = '...ALL' in the if part.
 
How many records you have ,also post some sample data so that I can check ...
 
cheers
rahul


Posted By: sengle
Date Posted: 24 Jul 2008 at 2:55pm
Rahul,
I emailed you at mailto:rahulwalawalkar@yahoo.com - rahulwalawalkar@yahoo.com  hoping that you still have this email.  I wanted to give you screen shots which this forum doesn't support.
Let me know if this email address is no longer good.
Thanks,


Posted By: rahulwalawalkar
Date Posted: 25 Jul 2008 at 2:11am
Replied to your email ..... hope the solution works....
 
cheers
Rahul



Print Page | Close Window