Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Formatted numeric variables
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] Formatted numeric variables
 Login/Join
 
Gold member
posted
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
 
Posts: 66 | Registered: May 20, 2013Reply With QuoteReport This Post
Guru
posted Hide Post
-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
 
Posts: 398 | Registered: February 04, 2008Reply With QuoteReport This Post
Expert
posted Hide Post
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 
 
Posts: 5684 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Guru
posted Hide Post
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
 
Posts: 398 | Registered: February 04, 2008Reply With QuoteReport This Post
Gold member
posted Hide Post
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
 
Posts: 66 | Registered: May 20, 2013Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Formatted numeric variables

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.