US and Worldwide: +1 (866) 660-7555
Results 1 to 5 of 5

Thread: Set boolean depending on a field value

  1. #1
    Join Date
    May 2006
    Posts
    152

    Default Set boolean depending on a field value

    Hi,
    I need a hint because, probably I am not doing things in the smarter way

    I need to set a boolean to true if a string field of my contains a determined value:

    Example:

    If my_string contains foo then boolean=true

    Now I am achieving my goal with:
    - one filter rows
    - checking the value of my_string
    - splitting the flow in two branches
    - setting boolean to true in the true branch, and false in the false one
    - joining the flow

    That seems too complicated, even if it works.

    Is there a smarter way, please?

    Thank you,
    nicola

  2. #2
    Join Date
    Apr 2008
    Posts
    1,758

    Default

    You can use a JavaScript step to do that, and it might be faster.

    There is talk that in one of the upcoming versions, there will be a step that sets a value based on another value (Set booleanField=True when MyString = "foo") but it's not clear if that will take sub-strings or not.

  3. #3
    Join Date
    May 2006
    Posts
    152

    Default

    Hi,
    I am not a fan of JavaScript, so my knowlegde is very little.
    Can you please suggest me what is the function to check if a string contains another string?
    I haven't found .contains()

    Thank you,
    nicola

  4. #4
    Join Date
    Apr 2008
    Posts
    1,758

    Default

    It's not a nice simple boolean, you have to put some code around it...

    Code:
    var idxContain = indexOf(InputString, "SearchString")
    var boolOutput = (idxContain >= 0)
    Use the "Get Fields" button, and you should be close to working.
    Last edited by gutlez; 01-30-2009 at 12:44 PM.

  5. #5
    Join Date
    May 2006
    Posts
    152

    Default

    Thank you very much.
    That helped me greatly!
    Ciao
    Nicola

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •