Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Record Selection - number to string 1

Status
Not open for further replies.

thisisboni

Programmer
Jun 1, 2006
113
0
0
US
Hi:

For a given report there is an input parameter of type Number and 'Allow multiple values' checked.
The report is running fine but if one has to enter a lot of parameters then it has to be done one by one !!
Current Record Selection is
{V_RPT_EVENT.PRGM_ID} = {?Event ID}

Is there a way where the users enter the numbers separated by a comma and the report generates the same output ?

I tried split etc.. - but no luck so far !

Any help will be appreciated.

Thanks
 
Can you use IN ???

{V_RPT_EVENT.PRGM_ID} IN [{?Event ID}]

... and enter the items in Event ID such as "A", "B", "C"

Hope this helps.


RSGeek
(currently using Crystal Reports XI with Lawson 8.03)
 
Thanks for the reply but unfortunately that did not work

the goal is to enter data in input parameter {?Event ID} as
12343,123123, 123232, 232322,343423

and the report return data in accordance -

 
In setting up the parameter, at the bottom there are a list of options. Chang "Allow range values" to True.

:)


RSGeek
(currently using Crystal Reports XI with Lawson 8.03)
 
that will give you a 'start of range' and 'End of Range'

{V_RPT_EVENT.PRGM_ID} is a numeric field
{?Event ID} needs to accept inputs as 12,234,23233

tx
 

Change your parameter type to String and try:

totext({V_RPT_EVENT.PRGM_ID},"#",0) in ({?My Parameter})

 
Tried that too - no luck !!
the closest I came was with this in the record selection

totext({V_RPT_EVENT.PRGM_ID},"#",0) IN split({?Event ID},",")

this however picks up only the first number in the parameters

that is say I enter

12,23,32

report returns 12 only even though there is data for the other records !
 
What if you entered the data like "12, "23", "32"??


RSGeek
(currently using Crystal Reports XI with Lawson 8.03)
 
can't do that - it will be a requirements change etc... -
 

The formula I posted is working for me - I would suggest placing the code you're testing in a formula, and put the formula in the details section.

That way you'll see visually True or False, and that might give you some insight into what is happening. Once you get it right, paste it into the record selection formula.

 
I see the issue - thank you for guiding me the right direction - I will get back with exact findings -
 

My original formula was flawed - there was a possibility that it would include records that were not in the parameter values. But this will work:

In the report header place this formula and suppress it:

beforereadingrecords;
stringvar array v_array;
v_array := split({?My Parameter},",");
v_array[1]

In the detail section place this formula (I'll call it @Test) and suppress it:

whilereadingrecords;
stringvar array v_array;
totext({Orders.Order ID},"#",0) in v_array

Then your record selection can just be:

{@Test}

 
Hi briangriffin and everyone,

This is absolutely brilliant - what skills you have!!

I now have to work out how where I can use it [2thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top