PDA

View Full Version : Set boolean depending on a field value



nico.ben
01-23-2009, 01:07 PM
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

gutlez
01-23-2009, 03:26 PM
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.

nico.ben
01-29-2009, 11:42 AM
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

gutlez
01-29-2009, 03:42 PM
It's not a nice simple boolean, you have to put some code around it...



var idxContain = indexOf(InputString, "SearchString")
var boolOutput = (idxContain >= 0) Use the "Get Fields" button, and you should be close to working.

nico.ben
01-30-2009, 09:43 AM
Thank you very much.
That helped me greatly!
Ciao
Nicola