Focal Point
[CLOSED] cannot correctly display calculated field

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

February 26, 2009, 03:22 PM
Selena B
[CLOSED] cannot correctly display calculated field
Hello all,
I am trying to put together a summary report. I can get all the data to display as needed except for the margin field listed below.

CATEG SUBCAT AMT $
categ1 Subcat1 $$
Subcat2 $$
Total categ1 $$
Margin $$

categ2 subcat1 $$
subcat2 $$
subcat3 $$
total categ2 $$
Margin $$

etc...

-*Margin needs to be a calculated field that will display the following:
(where acctnmbr GE 1 and acctnmbr LE 5 then sum(amt))/(where acctnmbr ge 10 and acctnmbr LE 20 then sum(amt))
(account numbers that make up margin will be different for each section)

With the code I'm using as of now, I don't know how to get this to display. I have case statements that make up the categ and subcat fields. I tried adding case statements for the 'Margin' field but I still cannot get it to display the correct way. There are 6 categories and a few sub categories within each category. The calculated fields that I need to display are related to each categ and subcat (the account numbers that make up the margin calc include the same account numbers that make up each categ and one or two subcats. I've tried creating define fields and using the categ and subcat fields to do the division I need but I need the actual $ amount, not the names of the categ and subcat fields. I also tried then adding a compute to the code below but I get an error about 'recap'.


DEFINE FILE HOLD
SORT/A50 = IF CATEG EQ 'Revenue' THEN '1'
ELSE IF CATEG EQ 'Cost of Sales' THEN '2'
ELSE IF CATEG EQ 'Service COS' THEN '3'
ELSE IF CATEG EQ 'Indirect COS' THEN '4'
ELSE IF CATEG EQ 'General & Administrative' THEN '5'
ELSE IF CATEG EQ 'Other Income/Expense' THEN '6' ELSE '';
END
-******************************************************************************************
-* DISPLAY FINAL REPORT
-******************************************************************************************
TABLE FILE HOLD
SUM AMT
BY SORT NOPRINT
BY CATEG
BY SUBCAT
ON CATEG SUBTOTAL AS 'Total'
WHERE SUBCAT NE ''
END

Any suggestions?

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


7.1.7
Vista
February 27, 2009, 10:59 AM
Darin Lee
You'll probably need the margin field to be inserted in a subfoot because it is a completely separate calculation. In order to get that value, you'll have to

COMPUTE VAL1/D12.2=IF ACCTNMBR GE 1 AND ACCTNMBR LE 5 THEN AMT ELSE 0; NOPRINT
COMPUTE VAL2/D12.2=IF ACCTNMBR GE 10 AND ACCTNMBR LE 20 THEN AMT ELSE 0;
MARGIN/D6.2=VAL1/VAL2; NOPRINT

Then you can insert the MARGIN field into a subfoot. Seems like this should get what you need - I'm having a little trouble understanding exactly what it is you need. You're referencing account numbers but there is no account number field specified in your code. And you mention category and subcategory a lot but I don't know where they fall into play except as sort fields.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
February 27, 2009, 01:46 PM
FrankDutch
Selena

What you want is typical for a financial report.

Information Builders created therefor the FML functionality.
Take a look at the documentation and see if this works for you.

You can do several calculations , subtract, divisions etc diver per column or let it depend on certain conditions.

Search for FML!




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

March 01, 2009, 08:41 PM
Selena B
I did some research and FML seems to be exactly what I need. Thanks for all of the responses. I will read up on FML and try coding my report that way.


7.1.7
Vista