Prepare recipe Formula Question

Solved!
AaronCrouch
Level 3
Prepare recipe Formula Question

I have a prepare formula, if FrameSize from the primary source is blank, use frame size from the other source. It works, unless both the primary and secondary source are '7F', in that case it changes to '7.0'. Can anyone see why?

 

Capture.PNG

1 Solution
AaronCrouch
Level 3
Author

I solved it. I took my initial formula, then added a step to replace values of "7.0" with "7F" directly after.

View solution in original post

4 Replies
Alex_Combessie
Dataiker Alumni

Hi,

If your data needs to be treated as a string in the formula, you can use strval("myColumnName"). Alternatively, if you want numeric, use numval("myColumnName"). Otherwise, your data type will be inferred, so 7F is inferred to a double 7.0.

Hope it helps,

Alex 

AaronCrouch
Level 3
Author

Thanks for your reply.

After making the modification, now my field comes up as blank.

I also tried renaming the column so the column is created by my script. It still comes up blank.

AaronCrouch
Level 3
Author

I solved it. I took my initial formula, then added a step to replace values of "7.0" with "7F" directly after.

Alex_Combessie
Dataiker Alumni

Hi,

Could you please try again the previous solution, but this time with quotes "" inside strval:

if(isBlank(AT_FrameSize), strval("VP_FrameSize"), strval("AT_FrameSize"))

This will ensure it works for all values, not only 7F but any character values.

Cheers,

Alex