Focal Point
[CLOSED] IF Condition usage in where clause

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/1381057331/m/8347074776

July 28, 2015, 11:12 AM
Ramkumar28782
[CLOSED] IF Condition usage in where clause
Hi,

I am building a chart and want to use parameters.
One of the parameter should be used as following
If parameter value is "ALL" then query should not include that parameter, otherwise query should include value in the parameter.

GRAPH FILE ibiapp/dq_dashboard_chart1
-* Created by Info Assist for Graph
SUM COMPUTE Compute_1/D12.2=AVE.DQ_DASHBOARD_CHART1.DQ_DASHBOARD_CHART1.AVG_SCORE * 10 ; AS 'General Ticket'
BY DQ_DASHBOARD_CHART1.DQ_DASHBOARD_CHART1.ADDENDUM
ACROSS Define_1
WHERE Define_1 GT DT('&WEEK1. (|FORMAT=HMDYY-). From Date eg 01-01-2015..') AND Define_1 LT DT('&WEEK2. (|FORMAT=HMDYY-). To Date eg 01-01-2015..')
AND (IF (&CARD_ACCPTR_BUS_CD. (|FORMAT=A4V).MCC.) NE ''ALL'' THEN DQ_DASHBOARD_CHART1.DQ_DASHBOARD_CHART1.CARD_ACCPTR_BUS_CD EQ ( &CARD_ACCPTR_BUS_CD. (|FORMAT=A4V).MCC. )); HEADING

This AND condition is giving me error.
Please suggest usage of IF else condition in where clause.

Thank you.

This message has been edited. Last edited by: <Kathryn Henning>,


webfocus 8.1
windows, html
July 28, 2015, 11:27 AM
Tomsweb
Please show the error message. I don't think it likes 'AND IF...'


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
July 28, 2015, 11:58 AM
Ramkumar28782
quote:
AND (IF (&CARD_ACCPTR_BUS_CD. (|FORMAT=A4V).MCC.) NE ''ALL'' THEN DQ_DASHBOARD_CHART1.DQ_DASHBOARD_CHART1.CARD_ACCPTR_BUS_CD EQ ( &CARD_ACCPTR_BUS_CD. (|FORMAT=A4V).MCC. ));


You are right it does not like the AND there.
I want to know the usage of IF in where clause AND condition.

Parsing error : Encountered AND at line 16, column 1


webfocus 8.1
windows, html
July 28, 2015, 12:05 PM
Tomsweb
Just test where syntax with the car file and some made up values
Also, look at WHERE syntax in technical documentation.


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36