I am using Crystal Reports XI. I have written an SQL Command and I am trying to create a multi value parameter in the command and a date range parameter. It is not allowing me to do it. Is there any way I can do this?
SELECT city_name FROM city_list
WHERE state_cd IN ('GA','NC','SC')
I did a test with the report wizard in v10, and chose the "is one of" option, which seemed like it might be a logical equivalent. However, it built a (state_cd = 'GA' or state_cd = 'NC' or state_cd = 'SC') where clause phrase instead of using an IN operator. (Not an exact equivalent, as the IN operator doesn't handle NULL well in my experience.)
I tried creating a sql statement directly using the Add Command feature of the data expert.
SELECT city_name FROM city_list
WHERE state_cd IN ({?PI_STATE_LIST})
The idea was to see if a multi-valued list showed up as a comma-delimited list that could replace the parameter placeholder. If so, it might get the results I wanted. Single quote marks surrounding the items in the list might prove problematic, but the technique might work for numbers.
No such luck, the multi-value option wasn't available for a parameter created via the add command.
Looks like you will need to filter the records out in the report instead of the original query, unless there is an ability to dynamically create a SQL statement at runtime.
Just learning CR, I haven't got that far in the manuals yet.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.