Filter Expression That Looks For A Substring

Hey there!

New to ReTool and we'll say ~rusty~ with Javascript.

Trying to create a workflow that takes the results of a query and then creates a filter to only let through some of those rows if EmployeeID matches the format of SLS-----.

For the life of me, I can't find a filter expression that works.

value.EmployeeID.test('SLS') throws an error that says it isn't a function and
value.EmployeeID.includes('SLS') says .includes is undefined.

Long story short, I want value.EmployeeID to evaluate true or false if SLS appears in it. What am I missing?

(and yes, I realized I could take care of this in the WHERE clause of the earlier query but since I'm new to ReTool I want to understand how the Filter block works even if I'm not using it the wisest way.)

image

put that in {{curly braces}}

image

ok well without seeing it in more context and detail I don't know what to add though it should be something from the result of what you are running before it...

Well, I didn't solve this in a filter block and did it with a code block instead. Probably not the most elegant solution but in case someone else needs inspiration, here ya go.

1 Like