Lookup function returning error: Error trying to coerce 'FS4253' to a number

8.1.0

I have a dataset and i’m trying to use lookup to lookup a value in the Value column. It’s finding it, but for some reason it’s trying to return it as an integer?

Expression within a transform (hardcoded values for testing; value is bound to the dataset):
lookup({value}, 4151, -1, 'Value', 'Label')

Dataset:
image

"#NAMES"
"Value","Label"
"#TYPES"
"I","str"
"#ROWS","24"
"4151","FS4151"
"4152","FS4152"
"4153","FS4153"
"4154","FS4154"
"4155","FS4155"
"4156","FS4156"
"4157","FS4157"
"4158","FS4158"
"4159","FS4159"
"4160","FS4160"
"4161","FS4161"
"4162","FS4162"
"4175","FS4175"
"4176","FS4176"
"4177","FS4177"
"4178","FS4178"
"4179","FS4179"
"4180","FS4180"
"4181","FS4181"
"4182","FS4182"
"4183","FS4183"
"4184","FS4184"
"4185","FS4185"
"4186","FS4186"

image

Looks like a bug to me?
I’ve tried the reverse (lookup the Label) and this works correctly and returns the Value. Not useful for me though

Try changing the default value (-1) to a string ("-1").

2 Likes

Yep that was it, cheers! I’ve seen that before as well. Must be lack of sleep :sleeping: