cancel
Showing results for 
Search instead for 
Did you mean: 

Printing labels from a list of values separated by comma

0 Kudos

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' ?

Accepted Solutions (1)

Accepted Solutions (1)

abhilash_kumar
Active Contributor
0 Kudos

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

0 Kudos

Hi Abhilash,

many thanks again for your help.

I have put a double ' instead of the comma


{INVENT.PART_NO} IN Split({?PART_NO}, '''')


and it works fine > I have the WHERE clause

(   except for the equality INVENT.PART_NO='' OR INVENT.PART_NO='' OR INVENT.PART_NO=','           which gives nothing)

Answers (0)