Skip to main content

I am pushing data that I have cast as a double number to the JSONTemplater - it goes in as 0.09 once it comes out it gets longer becoming: "prod_index" : 0.09000000000000001

This seems like a floating point rounding number issue. Can anyone suggest a way around this.

Many Thanks,

Oliver

 

Try something like:

{
    "prod_index": fn:round(fme:get-attribute("prod_index"), 2)
}

 


Try something like:

{
    "prod_index": fn:round(fme:get-attribute("prod_index"), 2)
}

 

did the trick thank you, it is a pity those functions arent listed in the text editor functions list on the left hand side.


did the trick thank you, it is a pity those functions arent listed in the text editor functions list on the left hand side.

I agree. But you can find more information by googling for XQuery functions, e.g. "xquery round" etc.


Reply