Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Record selection issue

Status
Not open for further replies.

northw

MIS
Nov 12, 2010
140
0
0
US
I have a record selection formula, Which was working fine Till I added another clause to it.

Before changing(Which was working fine):
IF {Query1. Acronym} = "ABC" AND ( (join({?prm_BCD},',')) = 'HEMO') then {Query1.Desc} like "Home"
Else IF {Query1.Acronym} = "ABC" AND ( (join({?prm_BCD},',')) <> 'HEMO') then {Query1.Desc} <> "Hemo"
Else if {Query1. Acronym} <> 'ABC' then {Query1.Desc} <> "Hemo"

After changing(Its throwing me an error crw32.exe and shutting down):
IF {Query1. Acronym} = "ABC" AND ( (join({?prm_BCD},',')) = 'HEMO') then {Query1.Desc} like "Home"
Else IF {Query1.Acronym} = "ABC" AND ( (join({?prm_BCD},',')) <> 'HEMO') then {Query1.Desc} <> "Hemo"
ELSE IF {Query1. Acronym} = "EFG" AND ( (join({?prm_BCD},',')) = 'HEMO') then {Query1.Desc} like "EFG Home"
Else IF {Query1. Acronym} = "EFG" AND ( (join({?prm_BCD},',')) <> 'HEMO') then {Query1.Outcome Group Desc} <> "EFG Home" and {Query1.Outcome} <> "Home"
Else if {Query1. Acronym} <> 'ABC' AND {Query1.Acronym} <> 'EFG' then {Query1.Desc} <> "Hemo" and {Query1.Desc} <> "EFG Home"

Thanks in advance.
 
You have not used a wild card in your like

ELSE IF {Query1. Acronym} = "EFG" AND ( (join({?prm_BCD},',')) = 'HEMO') then {Query1.Desc} like "EFG Home"

Try

ELSE IF {Query1. Acronym} = "EFG" AND ( (join({?prm_BCD},',')) = 'HEMO') then {Query1.Desc} like "EFG Home*"

But even so I can't see why that would cause crw32.exe error.

If it still happens try looking at the SQl generated. But ofcourse Crystal might crash before it can create SQL.

Ian
 
I think you have unnecessary parens in some places and missing parens in others.

IF {Query1. Acronym} = "ABC" AND
join({?prm_BCD},',') = 'HEMO' then
{Query1.Desc} like "Home" Else

IF {Query1.Acronym} = "ABC" AND
join({?prm_BCD},',') <> 'HEMO' then
{Query1.Desc} <> "Hemo" ELSE

IF {Query1. Acronym} = "EFG" AND
join({?prm_BCD},',') = 'HEMO' then
{Query1.Desc} like "EFG Home" Else

IF {Query1. Acronym} = "EFG" AND
join({?prm_BCD},',') <> 'HEMO' then
(
{Query1.Outcome Group Desc} <> "EFG Home" and
{Query1.Outcome} <> "Home"
) Else
if {Query1. Acronym} <> 'ABC' AND
{Query1.Acronym} <> 'EFG' then
(
{Query1.Desc} <> "Hemo" and
{Query1.Desc} <> "EFG Home"
)

-LB
 
I think it's your last test that is causing the issue, you can't have a select condition based purely on db fields.

It's a bit like chicken and egg

I would rewrite this as

If Join({?prm_BCD},',') = 'HEMO' Then
(
({Query1.Acronym} = "ABC" and {Query1.Desc} like "Home*")
or
({Query1.Acronym} = "EFG" and {Query1.Desc} like "EFG Home*")
(
Else
(
({Query1.Acronym} = "ABC" and {Query1.Desc} <> "Hemo")
or
({Query1.Acronym} = "EFG" and {Query1.Outcome Group Desc} <> "EFG Home" and {Query1.Outcome} <> "Home")
(

Gary Parker
MIS Data Analyst
Manchester, England
 
PS. If you are using "like" it implies the use of a wildcard "*", e.g., like "*Home*"

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top