Focal Point
[SOLVED]Calculate TOTAL using filter in Master file

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

February 05, 2016, 09:27 AM
Neelima
[SOLVED]Calculate TOTAL using filter in Master file
Hi All,

May be I am wrong. But I want to know ,
Can we create a DEFINE/COMPUTE field for storing total of a field using filters in Master file.

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


WebFocus 8104,8204
Excel/PDF/HTML/HTMLTABLE/XML/ALPHA/GIF file/GRAPH/Active technologies
February 05, 2016, 09:40 AM
BabakNYC
Could you describe a use case for such a thing?


WebFOCUS 8206, Unix, Windows
February 05, 2016, 09:55 AM
Neelima
Employee Manager developer tester
x 0 0 1
y 1 0 0
z 0 1 0

In above, scenario I have to calculate Number of manager, number of developer and number of tester.


WebFocus 8104,8204
Excel/PDF/HTML/HTMLTABLE/XML/ALPHA/GIF file/GRAPH/Active technologies
February 05, 2016, 11:14 AM
eric.woerle
Neelima,

You can definitely create a compute field in the Master file. just include the compute logic in the segment for the compute. I don't understand what you mean by "Using Filters". Maybe you want to try using the synonym editor to create some basic samples for yourself.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
February 07, 2016, 02:06 PM
Neelima
Empid manager_flag Developer_flag tester_flag project
a N N Y PROJECT A
B Y N N PROJECT A
C N N Y PROJECT B
D Y N N PROJECT A
E N Y N PROJECT B
F Y N N PROJECT A

like above, I need to calculate how many employees are manager, developer and tester for particular project.for that, I need to create compute field in MASTERFILE for that,I have tried with
DEFINE TOT/D12=TOT.empid; TITLE='Manager Count',RESTRICT = VALUE_WHERE,VALUE = Manager_flag EQ 'Y'; $

ABOVE code is not giving the correct result.

Please suggest.


WebFocus 8104,8204
Excel/PDF/HTML/HTMLTABLE/XML/ALPHA/GIF file/GRAPH/Active technologies
February 07, 2016, 03:08 PM
Neelima
can you share some code for WHERE based COMPUTE and DEFINE..


WebFocus 8104,8204
Excel/PDF/HTML/HTMLTABLE/XML/ALPHA/GIF file/GRAPH/Active technologies
February 08, 2016, 05:49 AM
Neelima
I have used filter in MASTER file. Its give me the following error

(FOC36241) FILTERS DON'T EXIST FOR FILE NAME


WebFocus 8104,8204
Excel/PDF/HTML/HTMLTABLE/XML/ALPHA/GIF file/GRAPH/Active technologies
February 08, 2016, 10:57 AM
eric.woerle
Neelima,

the code: RESTRICT = VALUE_WHERE,VALUE = Manager_flag EQ 'Y'; $

is something that you would add as part of the DBA restrictions. From what you are describing, thats not what you are doing. I think you are over thinking this. Just write a simple define.

DEFINE MNGR_FLAG/I8=IF MANAGER_FLAG EQ 'Y' THEN 1 ELSE 0;
 


Then just agreggate it at what ever level you need it in your query. You could use multi segment master files to do this... but chances are that you don't need that. I would just keep this simple for now.

TABLE FILE MYTABLE
SUM EMP_FLAG
BY PROJECT
END  



Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
February 09, 2016, 07:27 AM
Neelima
quote:
EMP_FLAG

Thanks Eric,

I have already done this code in my master file but it is not giving me the correct result.

I have to count distinct number of employee by project.


WebFocus 8104,8204
Excel/PDF/HTML/HTMLTABLE/XML/ALPHA/GIF file/GRAPH/Active technologies
February 10, 2016, 12:21 AM
Neelima
I have done this Business logic in fex using hold files and MATCH file command.
Thank you all..


WebFocus 8104,8204
Excel/PDF/HTML/HTMLTABLE/XML/ALPHA/GIF file/GRAPH/Active technologies