I’m looking to filter a particular group within a data set. Here’s where I am in the select expert
{name_full.NAMETYPE} = "a" and
(if {GENERIC.GROUPTAG} in ["A","B","C","D","E","F","G","H","I","J","K","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"] OR
{GENERIC.GROUPTAG} = "L" and
{MEMBERSHIP_FULL.MEMBTYPE} = "IALS" and
{SUBSCRIPTIONLEVEL_FULL.SUBLTYPE} = "life" THEN TRUE)
It works, but not very efficient. What other alternatives are there?
I usually avoid using “If” statements in the Select Expert - they frequently will not be passed to the database for processing, which means that Crystal will pull ALL of the data into memory and filter it there, slowing down the report. So, I would try rewriting what you have as something like this:
{name_full.NAMETYPE} = “a” and
({GENERIC.GROUPTAG} in [“A”,“B”,“C”,“D”,“E”,“F”,“G”,“H”,“I”,“J”,“K”,“M”,“N”,“O”,“P”,“Q”,“R”,“S”,“T”,“U”,“V”,“W”,“X”,“Y”,“Z”] OR
({GENERIC.GROUPTAG} = “L” and
{MEMBERSHIP_FULL.MEMBTYPE} = “IALS” and
{SUBSCRIPTIONLEVEL_FULL.SUBLTYPE} = “life” ))
problem with brackets place your or condition two statements in brackets.
({GENERIC.GROUPTAG} in [“A”,“B”,“C”,“D”,“E”,“F”,“G”,“H”,“I”,“J”,“K”,“M”,“N”,“O”,“P”,“Q”,“R”,“S”,“T”,“U”,“V”,“W”,“X”,“Y”,“Z”] OR
{GENERIC.GROUPTAG} = “L”)