Focal Point
(SOLVED) excel2k pivot questions - dynamic cache fields

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

September 15, 2011, 04:31 PM
jammer
(SOLVED) excel2k pivot questions - dynamic cache fields
Depending on a user selected variable I want the cache fields to change.

I am doing something like this:

-DEFAULT &NUM TO 'ODD';
CACHEFIELDS
-IF &NUM = 'ODD' THEN GOTO L_ODD;
-IF &NUM = 'EVEN' THEN GOTO L_EVEN;
-L_ODD;
ONE THREE FIVE SEVEN NINE
-GOTO L_END;
-L_EVEN
TWO FOUR SIX EIGHT TEN
-L_END

Is there a better way than this?

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


Webfocus 7.6.4
Windows 2003 Server, SQL Server 2005
Excel, HTML , JavaScript ,and PDF.
Reportcaster, BID, Tomcat
September 15, 2011, 05:02 PM
<FreSte>
The GOTO's make it less readable I think.
Maybe something like this ?

-DEFAULTH &NUM = 'ODD'
-SET &CACHEFIELDS = DECODE &NUM(
-   'ODD'    'ONE THREE FIVE SEVEN NINE'
-   'EVEN'   'TWO FOUR SIX EIGHT TEN'
-);

CACHEFIELDS &CACHEFIELDS

September 16, 2011, 09:38 AM
jammer
Thank You

Tested - and it works. Much more elegant!


Webfocus 7.6.4
Windows 2003 Server, SQL Server 2005
Excel, HTML , JavaScript ,and PDF.
Reportcaster, BID, Tomcat