Focal Point
[CLOSED] IF COUNT statement

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

June 06, 2014, 10:05 AM
hfung1
[CLOSED] IF COUNT statement
Hi,

I currently have a report where I am doing a COUNT of procedure volumes.

So I have a field called Intervention1, and another field called Intervention2. These two fields are simply the name of the intervention (the possible values in both fields are the same).

My report has no problem counting the number of times "A" comes up in Intervention 1 and Intervention 2. The problem I have is, Intervention 1 is the more "important" field, so if there is a value in Intervention1, I don't need to count the value in Intervention2. Basically, I only want to COUNT intervention 2 if Intervention 1 is null. Right now, I just have a WHERE clause (where intervention1 = "A" OR intervention2 = "A").

Is there anyway I can code this?

This message has been edited. Last edited by: hfung1,


8.0.0.2
Windows, All Outputs
June 06, 2014, 10:50 AM
susannah
sure
several ways
define a field that is exactly what you want
and then count that
DEFINE FILE ...
inter2/A1 MISSING ON = IF INTERVENTION1 EQ 'A' THEN MISSING ELSE INTERVENTION2;
END




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
June 08, 2014, 10:41 AM
Danny-SRL
I think what you want is:
  
DEFINE FILE ...
INTER2/{same format as intervantion2] MISSING ON = IF INTERVENTION1 EQ MISSING THEN INTERVENTION2 ELSE MISSING;
...
END



Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

June 09, 2014, 01:44 PM
hfung1
Hmm...it's not working for me:

DEFINE FILE
MONTHNO1/A11=EDIT(FISCAL_MONTH_OF_YEAR);
MONTHNO2/A2=EDIT(MONTHNO1,'$$$$$$$$$99');
MONTHNAME/A55=MONTHNO2 | ' ' | FISCAL_MONTH_OF_YEAR_NAME;
V_AGREEMENT.INT2_PROCEDURE/A10V MISSING ON = IF V_AGREEMENT.INT1_PROCEDURE EQ MISSING THEN V_AGREEMENT.INT2_PROCEDURE ELSE MISSING;
END

TABLE FILE V_AGREEMENT
COUNT
V_AGREEMENT.ACCOUNT_NUMBER
BY LOWEST V_AGREEMENT.INT1_PROCEDURE AS 'Intervention1'
BY LOWEST V_AGREEMENT.INT2_PROCEDURE AS 'Intervention2'
WHERE J0.DIM_DATE.DATE GE '2013-04-01';
WHERE J0.DIM_DATE.DATE LE '2014-03-31';
WHERE V_AGREEMENT.INT1_PROCEDURE EQ 'A' OR V_AGREEMENT.INT2_PROCEDURE EQ 'A';


8.0.0.2
Windows, All Outputs
June 16, 2014, 10:37 AM
Tamra
Hi Hugo,

Can you please clarify what you mean by "not working"? Do you get the incorrect value or an error message appears?

Thank you for clarifying.

Cheers,
Tamra Colangelo
Information Builders Customer Support Services.


WebFOCUS 8x - BI Portal, Developer Studio, App Studio, Excel, PDF, Active Formats and HTML5
June 16, 2014, 01:50 PM
RSquared
What do you want to do if intervaention1 is not equal to 'A' but intervention2 is equal to 'A'?


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
June 23, 2014, 09:12 AM
hfung1
quote:
V_AGREEMENT.INT2_PROCEDURE/A10V MISSING ON = IF V_AGREEMENT.INT1_PROCEDURE EQ MISSING THEN V_AGREEMENT.INT2_PROCEDURE ELSE MISSING


Sorry, what I meant by not working was that the table still shows everything...it does not only display intervention 2 if intervention 1 is null.


8.0.0.2
Windows, All Outputs
June 24, 2014, 12:52 AM
atturhari
quote:
V_AGREEMENT.INT2_PROCEDURE/A10V MISSING ON = IF V_AGREEMENT.INT1_PROCEDURE EQ MISSING THEN V_AGREEMENT.INT2_PROCEDURE ELSE MISSING


Do you need both BY fields?
How would the final output look like?

May be try this,
WHERE (V_AGREEMENT.INT1_PROCEDURE EQ 'A')
OR (V_AGREEMENT.INT1_PROCEDURE EQ MISSING AND V_AGREEMENT.INT2_PROCEDURE NE MISSING);


WF 7.7.02 on Windows 7
Teradata
HTML,PDF,EXCEL,AHTML
June 24, 2014, 08:50 AM
j.gross
I would DEFINE:

A_COUNT/I9C= (INT1_PROCEDURE EQ 'A') OR ((INT1_PROCEDURE IS MISSING) AND (INT2_PROCEDURE EQ 'A'));

and simply

SUM A_COUNT


- Jack Gross
WF through 8.1.05
June 24, 2014, 09:34 AM
RSquared
My question is what do you want to happen if INT_1 does not equal to 1 and INT_1 is not missing? Do you still want to look at INT_2?


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
June 25, 2014, 10:52 AM
hfung1
quote:
Originally posted by RSquared:
My question is what do you want to happen if INT_1 does not equal to 1 and INT_1 is not missing? Do you still want to look at INT_2?


This is what we want to show:

If INT1 = A, only show INT1
If INT1 = BLANK/Missing then go to INT2 and show INT2 = A
if INT 1 = NOT A but also NOT MISSING/BLANK, so let's say INT1 = B, it should NOT show either INT1 or INT 2

So basically, only look at INT2 if INT1 is missing/blank


8.0.0.2
Windows, All Outputs
July 01, 2014, 03:01 AM
jvb
quote:
I would DEFINE:

A_COUNT/I9C= (INT1_PROCEDURE EQ 'A') OR ((INT1_PROCEDURE IS MISSING) AND (INT2_PROCEDURE EQ 'A'));

and simply

SUM A_COUNT



As suggested above following can be used:
DEFINE FILE XYZ
A_COUNT/I9C= IF (INT1_PROCEDURE EQ 'A') OR ((INT1_PROCEDURE IS MISSING) AND (INT2_PROCEDURE EQ 'A')) THEN 1 ELSE 0;
END
TABLE FILE XYZ
PRINT A_COUNT
WHERE A_COUNT NE 0
END

This should return only the required set of records.


WF 8.1.04,Infoassist,Oracle, Excel, PDF,HTML.