views:

36

answers:

1

on my way to help a fellow I wrote a simple F-Script without even knowing the existing of such language

http://forums.marketcircle.com/eve/forums/a/tpc/f/2931083693/m/883106236

but I tried to find a way to round the number to 2 decimal places and I found nothing.

Can someone help me out that to finalize my help? Thank you.

The script is:

"Get amount to use from API"
amountEur := element valueForKeyPath:'parent.reportData.object.subtotalPlusMarkupMinusDiscount'.

"Let's convert to EEK"
amountEEK := amountEur / 15.6466.

"Return the value"
amountEEK.

working script after answer

"Get amount to use from API"
amountEur := element valueForKeyPath:'parent.reportData.object.subtotalPlusMarkupMinusDiscount'.

"Let's convert to EEK"
amountEEK := amountEur / 15.6466.

"Floor it"
floorEEK := ((amountEEK * 100) + 0.5) floor.

"Return the value"
floorEEK / 100.
+2  A: 

If there's not a native round fucntion then this will work:

Multipy by 100, floor, divide by 100.

thomasfedb
Multiply by 100, add 0.5, floor, divide by 100.
calmh
so simple ... thxs :)
balexandre