Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have an tExtractJSONFields that extracts the fields that I need. I can use those with no issues. But the api that I am getting json from only allows 5 results, so the next 45 or so all have a different json format.
The good results contain a status column that when I parse and print to a tLogRow, shows as ["OK"], I assume the brackets are a tLogRow thing as they don't show if I write that value later in the flow.
The bad results have no status column. The result is a status column with a value of [], I assume null.
How can I write a (Trigger->Run If) to only continue when the status column is equal to ["OK"], again not sure I need the brackets.
I've tried to trap the bad results with;
(String)globalMap.get("tExtractJSONFields_1.status") != "OK"
(String)globalMap.get("row1.status") != "OK"
-- row1 pointing to a tLogRow component.
I then have a tMsgBox that I try to print a value of status by making sure it is compared to a value I know will fail ("...status" != "blue") and it shows null when I try;
(String)globalMap.get("tExtractJSONFields_1.status")
(String)globalMap.get("row1.status")
The tMsgBox shows status as null even when the tLogRow prints status as "OK" !?
Hi @pthomas
I can give you 2 options :
1 - Use a tFilterRow and use the column "status" with function "equals" and put in your value at the end : "OK"
This way only rows with the value "OK" will be filtered.
2 - You can still use an "if" trigger but use
"OK".equals(row1.status)
And yes you are right the [ ] around "OK" is the tLogRow printing it
- Quentin
Hi @pthomas
I can give you 2 options :
1 - Use a tFilterRow and use the column "status" with function "equals" and put in your value at the end : "OK"
This way only rows with the value "OK" will be filtered.
2 - You can still use an "if" trigger but use
"OK".equals(row1.status)
And yes you are right the [ ] around "OK" is the tLogRow printing it
- Quentin
Thanks, I went with option #1, couldn't get the If part to work but tFilterRow splits the flow like I need.
Hey quentin, I'm not as in the clear as I thought. The issue I am having and trying to trap, is when a rest object returns a "fault", it does so with different columns. I'd expect that to result in a column (status) being null or at least "not equal" to "OK", But as you can see in the tLogRow, whether "OK" is the status or nothing is, it all fails.
I've tried "OK" and null and get the same results.
Hi @pthomas
You could probably add a tMap before the tFilterRow and try to replace null values with something else?
Add a function like this :
(row1.status == null || StringHandling.LEN(StringHandling.TRIM(row1.status)) == 0 ) ? "UNKNOWN" : status
This way you either have "OK" / "UNKNOWN" / Other values that are not null or empty and the tFilterRow have something to "use"
- Quentin