Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
My problem seems very simple, but I've been stuck for a long time.
I need to read a file and check if it contains a keyword.
Example
if in bob.txt there is the word "boby" -> action 1 otherwise action 2
It looks so simple.... 😞
Thanks in advance
Hi
You can read the file content as a string using tFileInputRaw component, then check the string if it contains a keyword "body",
tFileInputRaw--tJavaRow--runIf1--action1
*******************************--runIf2--action2
on tJavaRow:
if(input_row.content.toString().contains("body")){
globalMap.put("key",true);
}else{
globalMap.put("key",false);
}
set the condition of runIf1 as:
(boolean)globalMap.get("key")
set the condition of runIf2 as:
!(boolean)globalMap.get("key")
when the key is true, action1 will be triggered, otherwise, action2 will be triggered.
Hope it helps!
Regards
Shong