Focal Point
[SOLVED] Getting rid of leading 0s in an EDIT function

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

August 16, 2018, 10:41 AM
ccollier
[SOLVED] Getting rid of leading 0s in an EDIT function
I am using an EDIT function on some numbers because I need to concatenate them with a string.

 DEFINE FILE file
TABLEDATA/A700 = '''' || TIME_UNIT || '''' || ',' || EDIT(ACTIVE_PAID, '$$$$$$$$999999') || ',' || EDIT(TOTAL_PAID, '$$$$$$$$99999') || ',' || EDIT(TOTAL_ACCEPTED, '$$$$$$$99999') || ',' || EDIT(FILE_COMPLETE, '$$$$$$$$99999') || ',' || EDIT(TOTAL_APPLIED, '$$$$$$99999')
END
 


My TIME_UNIT outputs Fall (20xx).

I am taking all this data and putting it into an array because I'm using the Google Charts API which takes its data through an array. Here's the array data

['Fall 2015',661,799,3089,387,08311],
['Fall 2016',577,684,2992,358,08601],
['Fall 2017',567,684,3050,492,10025],
['Fall 2018',695,819,3522,639,12097],
['Fall 2019',015,015,0130,727,01556],


As you can see, with my edits I've gotten the leading zeros down for the most part, but the very last column is giving me troubles with data. Because of the leading zeros in front of the 1556, the data is displaying differently than the way it should. Is there a way to get rid of these 0s? Perhaps with another function?

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


WebFOCUS 8.2.01M on Windows 10
August 16, 2018, 10:54 AM
Tony A
Use FPRINT or the newer EDIT2 function.

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 
August 16, 2018, 10:56 AM
MartinY
Try with this instead. Adjust length as requested. The alpha format must better be larger than the numeric one.
DEFINE FILE file
TABLEDATA/A700 = '''' || TIME_UNIT || '''' || ',' || LJUST(16, FPRINT(ACTIVE_PAID, 'I14', 'A16'), 'A16V)) || ',' || LJUST(16, FPRINT(TOTAL_PAID, 'I14', 'A16'), 'A16V') || ',' || LJUST(16, FPRINT(TOTAL_ACCEPTED, 'I14', 'A16'), 'A16V') || ',' || LJUST(16, FPRINT(FILE_COMPLETE, 'I14', 'A16'), 'A16V') || ',' || LJUST(16, FPRINT(TOTAL_APPLIED, 'I14, 'A16'), 'A16V');
END



WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
August 16, 2018, 11:52 AM
ccollier
Instead of doing it inside of WebFOCUS, I actually just edited a stored procedure I was using to output the data into strings.


WebFOCUS 8.2.01M on Windows 10
August 16, 2018, 12:22 PM
Hallway
Personally I would use the FTOA function
 
DEFINE FILE CAR
TABLEDATA/A700V='[''' || MODEL || '''' || ',' || FTOA(DEALER_COST,'(D12c)','A15V') || ',' || FTOA(RETAIL_COST,'(D12c)','A15V') || ',' || FTOA(SALES,'(D12c)','A15V') || ']' ; 
END

TABLE FILE CAR
PRINT TABLEDATA AS ''
ON TABLE SET PAGE-NUM OFF
END

-RUN
 



Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs: