Focal Point
[SOLVED] Can't open code in GUI - turning comments off and on

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

December 10, 2012, 03:21 PM
jseaburn
[SOLVED] Can't open code in GUI - turning comments off and on
Hi - I didn't really know how to describe this situation. I have this code that works...as long as I don't try to open it in the GUI. It wants to get rid of my &COMMENT_xx variables. I use these to turn off/on which fields I want to display depending on what the user selects as the prompt. Is there a better way to do this?
 -PROMPT &MEASURE.(<Road Hazards,ROAD>,<Factory Adjustments,FACADJ>).Select Measure.;

-SET &MEAS_RH = IF &MEASURE EQ 'ROAD' THEN 'YES' ELSE 'NO' ;
-SET &MEAS_ADJ = IF &MEASURE EQ 'FACADJ' THEN 'YES' ELSE 'NO' ;

-SET &COMMENT_RH = IF &MEAS_RH IS 'NO' THEN '-*' ELSE ' ';
-SET &COMMENT_ADJ = IF &MEAS_ADJ IS 'NO' THEN '-*' ELSE ' ';

-*-TYPE MEAS_RH=&MEAS_RH
-*-TYPE MEAS_ADJ=&MEAS_ADJ



JOIN
 SALES_CURR_PREV_FY_US.SALES_CURR_PREV_FY_US.PRODUCT_ID IN SALES_CURR_PREV_FY_US
 TO UNIQUE PRODUCTS_US.PRODUCTS_US.PRODUCT_ID IN PRODUCTS_US TAG J1 AS J1
 END
-***
DEFINE FILE SALES_CURR_PREV_FY_US
SLS_QTY/D12 = IF SALES_SOURCE EQ 'WHSE' OR 'WHSE-LA' OR 'DIR' OR 'NCW' THEN SALES_CURR_PREV_FY_US.SALES_CURR_PREV_FY_US.QTY ELSE 0;
ADJ_QTY/D12 = IF SALES_SOURCE EQ 'FACADJ' THEN SALES_CURR_PREV_FY_US.SALES_CURR_PREV_FY_US.QTY ELSE 0;
RH_QTY/D12 = IF SALES_SOURCE EQ 'ROAD' THEN SALES_CURR_PREV_FY_US.SALES_CURR_PREV_FY_US.QTY ELSE 0;
USR_PRC_BR/A3=IF SALES_CURR_PREV_FY_US.SALES_CURR_PREV_FY_US.PR_BR LT '10' THEN EDIT (SALES_CURR_PREV_FY_US.SALES_CURR_PREV_FY_US.PR_BR,'$$9') ELSE IF SALES_CURR_PREV_FY_US.SALES_CURR_PREV_FY_US.PR_BR LT '100' THEN EDIT(SALES_CURR_PREV_FY_US.SALES_CURR_PREV_FY_US.PR_BR,'$99') ELSE EDIT(SALES_CURR_PREV_FY_US.SALES_CURR_PREV_FY_US.PR_BR,'999');
QTY/I7=QUANTITY * (-1);
END


TABLE FILE SALES_CURR_PREV_FY_US
-*ON TABLE PCHOLD FORMAT HTML
SUM
     SALES_CURR_PREV_FY_US.SALES_CURR_PREV_FY_US.SLS_QTY AS 'Qty Sold'
     &COMMENT_ADJ SALES_CURR_PREV_FY_US.SALES_CURR_PREV_FY_US.ADJ_QTY AS 'Qty Return,Factory Adj'
     &COMMENT_RH SALES_CURR_PREV_FY_US.SALES_CURR_PREV_FY_US.RH_QTY AS 'Qty Return,Road Hazz'
     &COMMENT_ADJ COMPUTE ADJ_PCT_SALES/D9.2% = ( ADJ_QTY / SLS_QTY ) * ( -100 ); AS 'FA,% Sales'
     &COMMENT_RH COMPUTE RH_PCT_SALES/D9.2% = ( RH_QTY / SLS_QTY ) * ( -100 ); AS 'RH,% Sales'
&COMMENT_ADJ BY TOTAL HIGHEST COMPUTE ADJ_PCT_SALES/D9.2% = ( ADJ_QTY / SLS_QTY ) * ( -100 ); NOPRINT
&COMMENT_RH BY TOTAL HIGHEST COMPUTE RH_PCT_SALES/D9.2% = ( RH_QTY / SLS_QTY ) * ( -100 ); NOPRINT

BY  J1.PRODUCTS_US.BUY_LINE
ON TABLE SUBHEAD
"Adjustment % Sales by Buy Line"
"for <+0>&CURR_YTD_ST through &CURR_YTD_DT "
WHERE (( SALES_CURR_PREV_FY_US.XDATE GE '&CURR_YTD_ST_X' ) AND ( SALES_CURR_PREV_FY_US.XDATE LE '&CURR_YTD_DT_X' ));
WHERE J1.PRODUCTS_US.PRICE_LINE NE 'MISCCHGE' OR 'MISCTOT' OR 'ADVERTIS' OR 'BRANDED';
WHERE J1.PRODUCTS_US.BUY_LINE NOT LIKE 'MIEDTPP' OR 'MISC' OR 'COO%' OR 'HI%';
 

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


WebFOCUS 7.7.03
Linux / Universe Db
HTML/PDF/EXCEL/HTML Active
December 10, 2012, 03:51 PM
Waz
We use this technique all the time, but I would suggest that the comment variable be placed at the first character and have a '.EVAL' after it.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

December 10, 2012, 04:26 PM
jseaburn
I don't understand what you mean by the comment variable be placed as the first character. That's where I have it - I think? Could you show me in a line of my code?

Thanks!


WebFOCUS 7.7.03
Linux / Universe Db
HTML/PDF/EXCEL/HTML Active
December 10, 2012, 04:38 PM
Waz
SUM
     SALES_CURR_PREV_FY_US.SALES_CURR_PREV_FY_US.SLS_QTY AS 'Qty Sold'
     &COMMENT_ADJ SALES_CURR_PREV_FY_US.SALES_CURR_PREV_FY_US.ADJ_QTY AS 'Qty Return,Factory Adj'
     &COMMENT_RH SALES_CURR_PREV_FY_US.SALES_CURR_PREV_FY_US.RH_QTY AS 'Qty Return,Road Hazz'
     &COMMENT_ADJ COMPUTE ADJ_PCT_SALES/D9.2% = ( ADJ_QTY / SLS_QTY ) * ( -100 ); AS 'FA,% Sales'
     &COMMENT_RH COMPUTE RH_PCT_SALES/D9.2% = ( RH_QTY / SLS_QTY ) * ( -100 ); AS 'RH,% Sales'
&COMMENT_ADJ BY TOTAL HIGHEST COMPUTE ADJ_PCT_SALES/D9.2% = ( ADJ_QTY / SLS_QTY ) * ( -100 ); NOPRINT
&COMMENT_RH BY TOTAL HIGHEST COMPUTE RH_PCT_SALES/D9.2% = ( RH_QTY / SLS_QTY ) * ( -100 ); NOPRINT


You should have
SUM
     SALES_CURR_PREV_FY_US.SALES_CURR_PREV_FY_US.SLS_QTY AS 'Qty Sold'
&COMMENT_ADJ.EVAL SALES_CURR_PREV_FY_US.SALES_CURR_PREV_FY_US.ADJ_QTY AS 'Qty Return,Factory Adj'
&COMMENT_RH.EVAL SALES_CURR_PREV_FY_US.SALES_CURR_PREV_FY_US.RH_QTY AS 'Qty Return,Road Hazz'
&COMMENT_ADJ.EVAL COMPUTE ADJ_PCT_SALES/D9.2% = ( ADJ_QTY / SLS_QTY ) * ( -100 ); AS 'FA,% Sales'
&COMMENT_RH.EVAL COMPUTE RH_PCT_SALES/D9.2% = ( RH_QTY / SLS_QTY ) * ( -100 ); AS 'RH,% Sales'
&COMMENT_ADJ.EVAL BY TOTAL HIGHEST COMPUTE ADJ_PCT_SALES/D9.2% = ( ADJ_QTY / SLS_QTY ) * ( -100 ); NOPRINT
&COMMENT_RH.EVAL BY TOTAL HIGHEST COMPUTE RH_PCT_SALES/D9.2% = ( RH_QTY / SLS_QTY ) * ( -100 ); NOPRINT



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

December 11, 2012, 02:11 AM
MichaelBalle
I think it's better to use FOC_NONE (if available in your version of WebFOCUS):

-PROMPT &MEASURE.(,).Select Measure.;

-SET &MEAS_RH = IF &MEASURE EQ 'ROAD' THEN 'YES' ELSE 'NO' ;
-SET &MEAS_ADJ = IF &MEASURE EQ 'FACADJ' THEN 'YES' ELSE 'NO' ;

-SET &COMMENT_RH = IF &MEAS_RH IS 'NO' THEN 'FOC_NONE' ELSE ' ';
-SET &COMMENT_ADJ = IF &MEAS_ADJ IS 'NO' THEN 'FOC_NONE' ELSE ' ';

-TYPE MEAS_RH=&MEAS_RH
-TYPE MEAS_ADJ=&MEAS_ADJ

TABLE FILE CAR
SUM
DEALER_COST
RETAIL_COST
BY COUNTRY
BY CAR &COMMENT_RH
BY MODEL &COMMENT_ADJ
END
-RUN


WebFOCUS 7.6, 7.7
Windows, All Output formats
December 11, 2012, 11:14 AM
jseaburn
Thank you for the suggestions. Both techniques seem to work with regards to the results of the report. However, neither one allows me to open the fex in the GUI. I'm getting erros parsing the .mas file. I can continue to work around that problem as I've found I have to do that with many of my reports. I just wish there was a way to do this using the tools they want us to use. Thank you!!!


WebFOCUS 7.7.03
Linux / Universe Db
HTML/PDF/EXCEL/HTML Active
December 11, 2012, 03:01 PM
Doug
quote:
getting erros parsing the .mas file

Are you sue that's due to the fex, not he mas? Do a CHECK FILE FileName to make sure. ... Just a thought.
December 12, 2012, 03:55 AM
Wep5622
No, errors on "parsing the master" is just the report painter not even succeeding in telling what the issue is that it's encountering with the report (namely that it can't deal with intermixed dialog manager code).

Seeing that both bits of code are valid to use there and from the same manufacturer, that's kind of lame.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :