Focal Point
[SOLVED] Subtotal, ST. compute field

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

June 18, 2012, 12:26 PM
Henry
[SOLVED] Subtotal, ST. compute field
Hi all,

I am trying to add a compute field which include a subtotal of a SUM field.

Example: ST.SALES

But WebFOCUS is giving me this error message.
"(FOC003) THE FIELDNAME IS NOT RECOGNIZED: ST.SALES"
and
"(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED:
ST.SALES"
I am using WebFOCUS 7.7.02

Does anyone know the reason?

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


WebFOCUS 7.7.02
Windows, All Outputs
June 18, 2012, 02:24 PM
Danny-SRL
Henry,

ST. is only used in HEADINGs et al. with a caret for positioning.


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

June 18, 2012, 02:25 PM
Prarie
Where are you trying to use this? You can't use it in a compute.
June 20, 2012, 08:50 AM
Henry
Thank you Danny and Prarie,

I was trying to use it as a prefix TOT. in the compute field. To calculate the % contribution based on the subtotal instead of the column total.

Now that I know I can't use it in the compute. I will figure another way to calculate it.

Thanks


WebFOCUS 7.7.02
Windows, All Outputs
June 20, 2012, 03:00 PM
susannah
TABLE FILE IBISAMP/CAR
SUM SALES AS STSALES {NOPRINT}
BY CAR
SUM SALES
AND COMPUTE SHARE/D8%=100* SALES / C1;
BY CAR
BY MODEL
ON TABLE SUMMARIZE
END
??




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
July 03, 2012, 10:21 AM
Henry
Thank you Susannah!

That is what I wanted. Now I just have to modified the code with field names of my database.


WebFOCUS 7.7.02
Windows, All Outputs
July 03, 2012, 10:34 AM
susannah
TABLE FILE IBISAMP/CAR

SUM SALES
AND COMPUTE SHARE/D8%=100* SALES / (TOT.SALES);
BY CAR
BY MODEL
ON TABLE COLUMN-TOTAL
END
..this works, too




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
July 03, 2012, 10:54 AM
Henry
Thank you again Susannah, but the new one calculate the % based on the grand total. Whereas the old code calculate the % based on the car brand, which is what I am looking for. Smiler


WebFOCUS 7.7.02
Windows, All Outputs
July 03, 2012, 11:35 AM
susannah
showing you use of word 'TOTAL'
July 03, 2012, 01:51 PM
Henry
Thank you Susannah,

I have everything working now. But I want to add some columns to the right side of the table. I tried but couln't figure it out on my own.

Let say I want to add the following columns... What will be the code..
TOT.OH = Total on hand qty
IT.OH = In transit qty
ACT.OH = TOT.OH - IT.OH
TOT.OH % = same calculation as the Sales % cont, but using TOT.OH
ACT.OH % = same calculation as the Sales % cont, but using ACT.OH

TOT.OH      IT.OH      ACT.OH     TOT.OH %       ACT.OH %            



WebFOCUS 7.7.02
Windows, All Outputs
July 03, 2012, 03:19 PM
Henry
Now I have the following code, but only the share 3 (ACT.OH %) is calculating correctly... Share and share 2 are giving me 0%

Where did I do wrong?

TABLE FILE INVENTORY_DAILY_SNAPSHOT
SUM v_last_week_sales AS 'STSALES' NOPRINT
SUM INVENTORY_DAILY_SNAPSHOT.INVENTORY_INFO.DWF_INV_OH AS 'STOH' NOPRINT
SUM v_act_OH AS 'STACT' NOPRINT
BY INVENTORY_DAILY_SNAPSHOT.STORES_INFO.DWD_STORES_CODE
SUM v_last_week_sales
AND COMPUTE SHARE/D8%=100 * v_last_week_sales / C1 ;
INVENTORY_DAILY_SNAPSHOT.INVENTORY_INFO.DWF_INV_OH
INVENTORY_DAILY_SNAPSHOT.INVENTORY_INFO.DWF_INV_ITR_STR_QTY
v_act_OH
COMPUTE Share2/D8%=100 * INVENTORY_DAILY_SNAPSHOT.INVENTORY_INFO.DWF_INV_OH / C2 ;
COMPUTE share3/D8%=100 * v_act_OH / C3 ;
BY INVENTORY_DAILY_SNAPSHOT.STORES_INFO.DWD_STORES_CODE SUBTOTAL 
BY INVENTORY_DAILY_SNAPSHOT.PRODUCTS_HIERARCHY_INFO.DWD_PRODUCTS_CLASS
ON TABLE PCHOLD FORMAT HTML
ON TABLE SUMMARIZE
ON TABLE NOTOTAL
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET SQUEEZE ON
ON TABLE SET HTMLCSS ON
ON TABLE SET HTMLENCODE ON
END



WebFOCUS 7.7.02
Windows, All Outputs
July 04, 2012, 11:14 AM
Henry
I added 3 more column to the right end of the table and none of the % cont column works now...

TABLE FILE INVENTORY_DAILY_SNAPSHOT
SUM v_last_week_sales AS 'STSALES' NOPRINT
SUM.INVENTORY_DAILY_SNAPSHOT.INVENTORY_INFO.DWF_INV_OH AS 'STOH' NOPRINT
SUM.v_act_OH AS 'STACT' NOPRINT
SUM v_last_week_sales
AND COMPUTE SHARE/D8%=100 * v_last_week_sales / C1 ;
INVENTORY_DAILY_SNAPSHOT.INVENTORY_INFO.DWF_INV_OH
INVENTORY_DAILY_SNAPSHOT.INVENTORY_INFO.DWF_INV_ITR_STR_QTY
v_act_OH
COMPUTE SHARE2/D8%=100 * INVENTORY_DAILY_SNAPSHOT.INVENTORY_INFO.DWF_INV_OH / C2 ;
COMPUTE SHARE3/D8%=100 * v_act_OH / C3 ;
COMPUTE v_sales_vs_tot_oh/D8%= SHARE - SHARE2 ;
COMPUTE v_tot_oh_wos/D12.1=INVENTORY_DAILY_SNAPSHOT.INVENTORY_INFO.DWF_INV_OH /v_last_week_sales ;
COMPUTE v_act_oh_wos/D12.1=v_act_OH /v_last_week_sales ;
BY INVENTORY_DAILY_SNAPSHOT.STORES_INFO.DWD_STORES_CODE RECOMPUTE 
BY INVENTORY_DAILY_SNAPSHOT.PRODUCTS_HIERARCHY_INFO.DWD_PRODUCTS_CLASS



WebFOCUS 7.7.02
Windows, All Outputs
July 04, 2012, 03:37 PM
Henry
I figured out where my syntax error is, I am missing the BY statement before the SUM sales statement.

Now everything is working accordingly.


WebFOCUS 7.7.02
Windows, All Outputs