Bug with lookup expression on double?

Using 8.1.26.

I have a dataset travelMatrix as a custom property on the root container that looks like this - onewaycost with a column type double.

image

I have another custom property where I try to extract this 76.56 value.

I first tried extracting it with a lookup function like this lookup({Root Container.travelMatrix}, 3879, -1, 'userId', 'onewaycost') but this kept rounding the value to 77.0. I thought maybe it was just truncating for viewing purposes but binding this value to a numeric text field .double property it does come through at 77.0.

Accessing it directly with try({Root Container.travelMatrix}[3,'onewaycost'],-1.0) does work and I see 76.56, as does using @pturmel 's view function and doing something like try(view("SELECT onewaycost WHERE userId==3879",{Root Container.travelMatrix})[0,0],-1). But trying to use the lookup function it keeps rounding it without fail.

Not sure if this is expected behavior or if I am missing something here about using lookup for double/float values - it does say lookup returns object so I thought it wouldn't matter if it was a float/double etc.

You are supplying an integer fallback value. The datatype of the fallback value determines the return datatype. Make sure your fallback value has a decimal point.

3 Likes

Whoops. I somehow remembered to provide a -1.0 for the try directly but not my lookup. Appreciate it!