tb
Programmer
- May 27, 2003
- 328
Hi all,
(Newbie)
I am trying to build my WHERE clause with the IIF function.
I have 4 parameters that include a "ALL" option and that is what I am trying to cater for.
Have done is successfully when there is only one parameter involved,
IIF (Parameters!Rep.Value = "0", " WHERE A.Region = '" & Parameters!Region.Value & "'" , " WHERE A.Region = '" & Parameters!Region.Value & "' AND A.SLPRSNID = '" & Parameters!Rep.Value & "'")
but now I have multiple conditions ... have tried the following ...
" WHERE (CustomerServiceRatesReport.Region = @Region) " &
IIF (Parameters!Rep.Value = "0", "" , " AND CustomerServiceRatesReport.SLPRSNID = '" & Parameters!Rep.Value & "'") &
IIF (Parameters!Depot.Value = "0", "" , " AND CustomerServiceRatesReport.OFFID = '" & Parameters!Depot.Value & "'") &
IIF (Parameters!ContractType.Value = "0", "" , " AND CustomerServiceRatesReport.AV_Contract_Type = '" & Parameters!ContractType.Value & "'") &
IIF (Parameters!CustomerNumber.Value = "0", "" , " AND CustomerServiceRatesReport.CUSTNMBR = '" & Parameters!CustomerNumber.Value & "'")
The above does not give me any errors, but neither does it give me any results on the report - no matter what my parameter selections are.
Any help / pointers or suggestions on how I can make this work or alternatives would be much appreciated.
Thnx,
tb
I was standing in the park, wondering why frisbees got bigger as they came closer... then it hit me!
(Newbie)
I am trying to build my WHERE clause with the IIF function.
I have 4 parameters that include a "ALL" option and that is what I am trying to cater for.
Have done is successfully when there is only one parameter involved,
IIF (Parameters!Rep.Value = "0", " WHERE A.Region = '" & Parameters!Region.Value & "'" , " WHERE A.Region = '" & Parameters!Region.Value & "' AND A.SLPRSNID = '" & Parameters!Rep.Value & "'")
but now I have multiple conditions ... have tried the following ...
" WHERE (CustomerServiceRatesReport.Region = @Region) " &
IIF (Parameters!Rep.Value = "0", "" , " AND CustomerServiceRatesReport.SLPRSNID = '" & Parameters!Rep.Value & "'") &
IIF (Parameters!Depot.Value = "0", "" , " AND CustomerServiceRatesReport.OFFID = '" & Parameters!Depot.Value & "'") &
IIF (Parameters!ContractType.Value = "0", "" , " AND CustomerServiceRatesReport.AV_Contract_Type = '" & Parameters!ContractType.Value & "'") &
IIF (Parameters!CustomerNumber.Value = "0", "" , " AND CustomerServiceRatesReport.CUSTNMBR = '" & Parameters!CustomerNumber.Value & "'")
The above does not give me any errors, but neither does it give me any results on the report - no matter what my parameter selections are.
Any help / pointers or suggestions on how I can make this work or alternatives would be much appreciated.
Thnx,
tb
I was standing in the park, wondering why frisbees got bigger as they came closer... then it hit me!