TABLE FILE GGSALES SUM COMPUTE FMT/A8 = IF REGION EQ 'Northeast' THEN 'D15c' ELSE 'D15.2c'; NOPRINT DOLLARS/FMT BY REGION END
In FOCUS since 1986 | WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2 | ||
WebFOCUS App Studio 8.2.06 standalone on Windows 10 |
quote:Originally posted by Tony A:
Simplest method is to use dynamic reformatting.
Something like this -TABLE FILE GGSALES SUM COMPUTE FMT/A8 = IF REGION EQ 'Northeast' THEN 'D15c' ELSE 'D15.2c'; NOPRINT DOLLARS/FMT BY REGION END
The FMT compute in my example determines what the display format will be for the DOLLARS value. Its format must be "A8" and should be able to contain the format that you want to see in your output.
I have determined the format based on REGION but you should be able to compare it to the value itself.
Good luck and welcome to the forum.
T
TABLE FILE WF_RETAIL_LITE PRINT REVENUE_US COMPUTE MOD/D12.2 = MOD(REVENUE_US, 1); COMPUTE FMT/A8 = IF MOD EQ 0 THEN 'D12M' ELSE 'D12.2M'; REVENUE_US/FMT BY PRODUCT_CATEGORY BY TIME_DATE WHERE PRODUCT_CATEGORY EQ 'Accessories' WHERE TIME_DATE EQ '20130101' ON TABLE SET PAGE-NUM OFF ON TABLE SET CENT-ZERO ON ON TABLE SET STYLE * INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/flat.sty,$ ENDSTYLE END
quote:Originally posted by Tony A:
Simplest method is to use dynamic reformatting.
Something like this -TABLE FILE GGSALES SUM COMPUTE FMT/A8 = IF REGION EQ 'Northeast' THEN 'D15c' ELSE 'D15.2c'; NOPRINT DOLLARS/FMT BY REGION END
The FMT compute in my example determines what the display format will be for the DOLLARS value. Its format must be "A8" and should be able to contain the format that you want to see in your output.
I have determined the format based on REGION but you should be able to compare it to the value itself.
Good luck and welcome to the forum.
T
quote:Originally posted by Hallway:quote:Originally posted by Tony A:
Simplest method is to use dynamic reformatting.
Something like this -TABLE FILE GGSALES SUM COMPUTE FMT/A8 = IF REGION EQ 'Northeast' THEN 'D15c' ELSE 'D15.2c'; NOPRINT DOLLARS/FMT BY REGION END
The FMT compute in my example determines what the display format will be for the DOLLARS value. Its format must be "A8" and should be able to contain the format that you want to see in your output.
I have determined the format based on REGION but you should be able to compare it to the value itself.
Good luck and welcome to the forum.
T
That's FANTASTIC!! I had no idea that you can do that.
To take that a little further, I found that you can use the MOD function to evaluate the number and do this on any value that is a whole number:TABLE FILE WF_RETAIL_LITE PRINT REVENUE_US COMPUTE MOD/D12.2 = MOD(REVENUE_US, 1); COMPUTE FMT/A8 = IF MOD EQ 0 THEN 'D12M' ELSE 'D12.2M'; REVENUE_US/FMT BY PRODUCT_CATEGORY BY TIME_DATE WHERE PRODUCT_CATEGORY EQ 'Accessories' WHERE TIME_DATE EQ '20130101' ON TABLE SET PAGE-NUM OFF ON TABLE SET CENT-ZERO ON ON TABLE SET STYLE * INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/flat.sty,$ ENDSTYLE END
A little off topic, but if you prefer a leading zero on decimals that are < 1 and > -1 you can use the CENT-ZERO set command like I have in the code above.
quote:LOAD MODULE NOT FOUND: MOD
In FOCUS since 1986 | WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2 | ||
WebFOCUS App Studio 8.2.06 standalone on Windows 10 |