Prepare recipe Formula Question

Options
AaronCrouch
AaronCrouch Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered, Dataiku Frontrunner Awards 2021 Winner, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2022, Dataiku Frontrunner Awards 2021 Participant Posts: 18 ✭✭✭✭✭

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

Best Answer

  • AaronCrouch
    AaronCrouch Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered, Dataiku Frontrunner Awards 2021 Winner, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2022, Dataiku Frontrunner Awards 2021 Participant Posts: 18 ✭✭✭✭✭
    Answer ✓
    Options

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

Answers

  • Alex_Combessie
    Alex_Combessie Alpha Tester, Dataiker Alumni Posts: 539 ✭✭✭✭✭✭✭✭✭
    Options

    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
    AaronCrouch Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered, Dataiku Frontrunner Awards 2021 Winner, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2022, Dataiku Frontrunner Awards 2021 Participant Posts: 18 ✭✭✭✭✭
    Options

    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.

  • Alex_Combessie
    Alex_Combessie Alpha Tester, Dataiker Alumni Posts: 539 ✭✭✭✭✭✭✭✭✭
    Options

    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

Setup Info
    Tags
      Help me…