I am putting JSON values into a Postgres database, chaining InvokeHTTP, CovertJSONtoSQL, ReplaceText and PutSQL. The ReplaceText is adding an additional 'ON CONFLICT...' clause to my SQL.
As part of the ReplaceText, I'm using one of the sql attributes of the flowfile, which as far as I can tell is being persisted as a boolean (attribute is shown as 't' or 'f' in the flowfile). I need to convert this boolean (t or f) to a string ("TRUE" or "FALSE") in order that it works in my query. My tactic was to try ifelse() as in
${sql.args.3.value:ifElse("TRUE","FALSE")}
That always returns "FALSE" even when the attribute value it 't'.
I've made it work by casting it to a string first:
${sql.args.3.value:toString():equals('t'):ifElse("TRUE","FALSE")}
but I'm frustrated that it doesn't seem to work as expected. Any ideas?
Thanks!