Focal Point
[SOLVED] Formatted numeric variables

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

September 26, 2017, 04:06 PM
Joel Elscott
[SOLVED] Formatted numeric variables
Hi,

I'm creating a html page where a user will enter a numeric values into edit boxes, which will then update a permanent hold file. I want these fields to be stored as numeric values for calculations later on. Ideally the user can enter a value with or without formatting (comma's/decimals). In my example below, I'm getting an error "Result of expression is not compatible with the formal of the field". What am I doing wrong?

-DEFAULT &TOTAL_STATEMENTS = '2,125,162';
-DEFAULT &QTR_GROWTH_FACTOR = '0.991';


TABLE FILE CAR
SUM CAR NOPRINT
COMPUTE TOTAL_PTM_IMAGES/D12 = '&TOTAL_STATEMENTS';
COMPUTE QTR_GROWTH_FACTOR/D3.3 = '&QTR_GROWTH_FACTOR';
END

This message has been edited. Last edited by: Joel Elscott,


WebFOCUS 8.2.03
z/OS
September 26, 2017, 04:19 PM
RSquared
-DEFAULT &TOTAL_STATEMENTS = 2,125,162;
-DEFAULT &QTR_GROWTH_FACTOR = 0.991;


Try it this way

/*

TABLE FILE CAR
SUM CAR NOPRINT
COMPUTE TOTAL_PTM_IMAGES/D12 = &TOTAL_STATEMENTS ;
COMPUTE QTR_GROWTH_FACTOR/D5.3 = &QTR_GROWTH_FACTOR;
END
/*


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
September 27, 2017, 08:06 AM
Tony A
quote:
-DEFAULT &TOTAL_STATEMENTS = 2,125,162;

... will not work because of the embedded commas - WF thinks there is continued syntax coming.

So you need to have -DEFAULT &TOTAL_STATEMENTS = '2,125,162'; and then use something like this -
COMPUTE TOTAL_PTM_IMAGES/D12 = EDIT(STRREP(15,&TOTAL_STATEMENTS.QUOTEDSTRING,1,',',0,'x',15,'A15'));

T



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 
September 27, 2017, 10:33 AM
RSquared
Sorry but my last answer did not copy right. You cannot in the commas in the amount. Just enter the amount as a number. The report will show with the commas.


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
September 27, 2017, 10:44 AM
Joel Elscott
Thanks guys. The numbers are coming from a user entry screen, so I will need to strip out the comma's before I store them. (Which I know how to do)

Thanks again.


WebFOCUS 8.2.03
z/OS