I'm creating an event handler for the TaskPostPerform event to send the pdf generated by a background task to a list of users. Handling the task parameters has been a living hell because they are all inside a SETVARVALUES() function. After I finally achieved to get the parms I need, I do a query with a Load IDO Collection action filtered with my parameters, but I'm getting an error in the Event Handler Status form that says "Incorrect syntax near '~'"
Which is really strange because prior to my Load IDO Collection I have an Audit action where I write the values I substracted of the task parms, an this is how they look:

I don't see any ~ there... any ideas? By the way, this is the way I substract those values:
1. SETVARVALUES(eParmString = REPLACE(REPLACE(TASKPARMLIST(), "SETVARVALUES(", ""), "=)", '=""'))
2. SETVARVALUES(eParmString = SUBSTRING(V(eParmString), 1, -1 + (INSTR(V(eParmString), ",J"))))
3. SETVARVALUES(ECNStarting = SUBSTRING(V(eParmString), 1, -1 + (INSTR(V(eParmString), ","))), ECNEnding = SUBSTRING(V(eParmString), 1 + (INSTR(V(eParmString), ",")), LEN(V(eParmString))))
4. SETVARVALUES(ECNStarting = SUBSTRING(V(ECNStarting), 1 + (INSTR(V(eParmString), "=")), LEN(V(ECNStarting))),
ECNEnding = SUBSTRING(V(ECNEnding), 1 + (INSTR(V(ECNEnding), "=")), LEN(V(ECNEnding))))
The variables I'm using in my filter are ECNStarting and ECNEnding. Even if I make a new variable with the filter string and use it in the Load IDO Collection I get the same error.