Replace function

Hi there, I am trying to make a function to replace some values with null. I did it with on value but wanted to add more so I can clean more with one function. Can you help, please?


Best Answer

  • M.LambertM.Lambert Super Learner
    Answer ✓

    Hi Josh, thanks a lot for your help. That was spot on. Have a great day!


  • Josh BoxerJosh Boxer Administrator

    Hi, not entirely sure what you are trying to do, but it sounds like you are replace say 'blue' with null, but want to also replace 'green' and 'orange' with null?

    Firstly just checking but you need to create an advanced Function:

    either follow the link or create a standalone Function.

    Once you have done that there are quite a few different approaches. It is difficult to say which is best without more information on how many values you want to replace?, how similar those values are?, how frequently this list of values might change in future?

    Here is one idea:

    param test;
      _Equals([p:test], {'blue', 'green', 'orange'}),

Sign In or Register to comment.