You are not logged in.
Announcement
Unanswered posts
|
Pages: 1

I have created a context variable for example mxccy and set this to be a float i.e. a floating number
I am taking a report text file to convert it into an MYSQL database table
I mapped out the fields across the report line and for my value example AMOUNT as a string
The value I read for rpccy was 10,297,529.87 but it ended up as 10297530.00
You can try this out with the following code in tJavaFlex !!!!
String toparse = "10,297,529.87";
if(toparse.equals("")|| toparse == null)
toparse = "0.00";
else {
toparse = toparse.replace(" ","");
toparse = toparse.replace(",","");
};
String toparse1 = "10,297,529.87";
if(toparse1.equals("")|| toparse1 == null)
toparse1 = "0.00";
else {
toparse1 = toparse1.replace(" ","");
toparse1 = toparse1.replace(",","");
toparse1 = toparse1.replace(".","");
};
System.out.print("Float Number "+Float.parseFloat(toparse)+" ");
System.out.print("Integer Number "+Integer.parseInt(toparse1)+" ");
System.out.print("Fixed Number "+Numeric.convertImpliedDecimalFormat("99999999999999999V99",toparse1)+" ");
This will give you the results as
Float Number 1.029753E7 Integer Number 1029752987 Fixed Number 1.029753E7
Now all I need is a means of converting a Text value 10,297,529.87 into an MYSQL field mapped as DECIMAL(19,2) i.e. 17 leading digits with 2 decimal places.
Any suggestions that I coud use and able to store this large value in an approprite CONTEXT type in tJavaRow for use later in a tMap component .
Offline

Another test shows toparse1 = "12345678" gives Fixed Number 123456.78
BUT !!!!!!!! toparse1 = "123456789" gives Fixed Number 1234567.9
AND !!!!!!!! toparse1 = "123456712"; gives Fixed Number 1234567.1 thus rounding and truncation is happening
Offline

Used LONG integers to store in MYSQL then process using MYSQL procedure back to decimal data i.e divide by 100.
Offline
Pages: 1