<<If: true>> something <<EndIf>> will automatically include a comma. So it will produce
something,
That lead to some issues.
- The body of the if statement is a JSON object and it is at the end of JSON, that will lead to a trailing comma
- If we use the if statement within a normal tax in a JSON template, that will add unnecessary comma.
If I am missing on using the <If: >> statement, please let me know.
Thanks
Please read this thread
[Does a <<Start>> expression output a comma be...](https://community.appsheet.com/t/does-a-start-expression-output-a-comma-be/936/9) Questions
Ah, yes, that makes sense. I’ve no suggestion at this time. Thanks
Hi @Phil
Related to https://community.appsheet.com/t/does-a-start-expression-output-a-comma-be/936/8
I understand that adding comma between members of a list will be tricky but “if” statement should not be a problem.
In terms of syntax , can you add new expressions?
E.g <> or <> and within those new expression, no comma will be added. That will be similar to how frameworks introduce new functions without breaking old ones.
Thanks @Marc_Dillon for the link.
Hi @Steven_Aung just wondering if you found a solution or workaround to this problem in a JSON template?
I’ve encountered this issue with a Webhook POSTING JSON to a external API. I want to control the value of a specific JSON property based on the value of an Appsheet field, like so:
// rest of JSON template omitted for brevity
“name”: “<If:([Account_Group]=‘DTC’)>welcome_message_dtc<><If:([Account_Group]=‘Partner’)>welcome_message<>”,
The If statements add an extraneous ‘,’ at the end, which is not what the external API is expecting so the call fails.
Did you find a workaround?
Just FYI for anyone finding this thread, I raised the issue with Appsheet support, who gave the solution of replacing <><> with an Appsheet If() expression. This worked in my case of a webhook posting a JSON Payload to an external API, so just sharing here in case it helps others.