
Anonymous
Not applicable
2014-07-13
01:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[resolved] From STRING or INTEGER to float with two decimals
Hello
We receive a delimited text file with one of the field that looks like this :"00000073142"
This field is an amount of money and should be read like 731.42
From this field I have to calculate another one which is 15% of it, here it would be 15% of 731.42 = 109.71
When I declare the discount (15%) field as a Float value, whenever 15% of whatever amount is a sum that end with a 0 (for exemple 31,90), it will be outputed as 31,9
That's not good because I want to print this field and need it to looks like a price, with two decimals.
How can I say inside a tMap component that a float value must have two decimals, no more no less.
I have tried the precision at two but it doesn't look like my answer.
Here and there, I have found the I could use some java code (decimalformat or math.round)
Problem is I don't know how the call this java code inside tMap. It seems I should create a routine than call it from tMap, but I don't know how to do this.
Is the any to do this ?
Thanks a lot
We receive a delimited text file with one of the field that looks like this :"00000073142"
This field is an amount of money and should be read like 731.42
From this field I have to calculate another one which is 15% of it, here it would be 15% of 731.42 = 109.71
When I declare the discount (15%) field as a Float value, whenever 15% of whatever amount is a sum that end with a 0 (for exemple 31,90), it will be outputed as 31,9
That's not good because I want to print this field and need it to looks like a price, with two decimals.
How can I say inside a tMap component that a float value must have two decimals, no more no less.
I have tried the precision at two but it doesn't look like my answer.
Here and there, I have found the I could use some java code (decimalformat or math.round)
Problem is I don't know how the call this java code inside tMap. It seems I should create a routine than call it from tMap, but I don't know how to do this.
Is the any to do this ?
Thanks a lot
268 Views
1 Solution
Accepted Solutions

Anonymous
Not applicable
2014-07-14
05:10 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
If you have few operations to be called on each row and column, then I would ask you to use tJavaRow before tMap and do processing as required...
Use Ctrl+Space, this will invoke all the existing functions and you can write your own with the help of Java code.
Thanks
vaibhav
If you have few operations to be called on each row and column, then I would ask you to use tJavaRow before tMap and do processing as required...
Use Ctrl+Space, this will invoke all the existing functions and you can write your own with the help of Java code.
Thanks
vaibhav
268 Views
2 Replies

Anonymous
Not applicable
2014-07-14
05:10 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
If you have few operations to be called on each row and column, then I would ask you to use tJavaRow before tMap and do processing as required...
Use Ctrl+Space, this will invoke all the existing functions and you can write your own with the help of Java code.
Thanks
vaibhav
If you have few operations to be called on each row and column, then I would ask you to use tJavaRow before tMap and do processing as required...
Use Ctrl+Space, this will invoke all the existing functions and you can write your own with the help of Java code.
Thanks
vaibhav
269 Views

Anonymous
Not applicable
2014-07-22
01:12 AM
Author
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Sorry for this late feedback, I had to fly away for some days...
Anyway, thanks a lot for your help.
Sorry for this late feedback, I had to fly away for some days...
Anyway, thanks a lot for your help.
268 Views
