Printing labels from a list of values separated by comma
Hello,
I have to print labels from a list of part number values formated like that : '123344','456789','963254'
in only one parameter {?PART_NO}
So, I'm trying to use a select record in Crystal Report.
when I put a simple condition, I have the result quickly
{INVENT.PART_NO} = {?PART_NO}
=> when I look at the SQL query in Crystal I have this select condition right mentionned.
when I want to use the IN condition it reduces the speed of the query
{INVENT_PART.PART_NO} in {?PART_NO}
=> when I look at the SQL query in Crystal I haven't this select condition mentionned => it means that Crystal reads all the records (40000 records) to select the data after (?)
How do I improve that ?
I've read some posts dealing with calling a sub report
Is it possible to call x times a sub report with, for each call, a parameter ?
This parameter should be a part number, belonging to the string like '123344','456789','963254','999999' ?
Abhilash Kumar replied
Hi Ben,
If the values were simply a comma separated list without the quotes like this:
123344,456789,963254
You could use a record selection formula like this:
{INVENT.PART_NO} IN Split({?PART_NO}, ',')
Look at the SQL Query and you should see that it translates to the where clause as well.
-Abhilash