Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Creating a sql contains in Crystal XI

Is there any way of having crystal reports xi generate the sql statement for a record select formula that would be something similar to:

history.description like '%Parameter selection 1%' or '%Parameter selection 2%')

We have 1 parameter that we allow multiple selections for that runs against a column in a table that has multiple values separated by a comma. We can't seem to get crystal to generate a correct sql statement where it can break out the parameter selections and create a correct sql statement that would pull back records that satisfy the parameter conditions.

Former Member
replied

glad that it works.

the null value that you are seeing in the where clause won't affect anything but if you're like me and something like that is annoying you can use the following in your formula...just a couple extra lines at the end to get rid of that last value caused by the last separator.

numbervar counter;
global stringvar customers;
for counter:= 1 to count({?StringValue}) step 1 do 
(customers:= customers +  '*' + {?StringValue}[counter] + '*' + '|');
numbervar lc:= length(customers);
if lc > 1 then customers:= customers[1 to length(customers) - 1];
customers

Jason, i was not able to get at your sample by the way...when i click on the Download link i get an "unable to open this internet site" etc. error.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question