Skip to Content
avatar image
Former Member

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Apr 05, 2016 at 01:05 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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)