Hi @WillowMobileSys ,
Yes, I’m familiar with the SUBSTITUTE function, but how do I use it in a template block for JSON output? How do I use it with these instructions?
{
“id”: “<<[ID]>>”,
“EntrepriseID”: “<<[EntrepriseID]>>”,
“ContactID”: “<<[ContactID]>>”,
“nom_du_devis”: “<<[nom_du_devis]>>”,
“date_du_devis”: “<<[date]>>” <<If:COUNT([Related CAD])>0>>,
“publicitesCAD”: [
<<Start: [Related CAD]>>{
“numero”: “<<[id].[numero]>>”,
“date”: “<<[id].[sortie]>>”,
“format”: “[id].[format]”
}
<>
] <>
}
Of course. Silly me. I misunderstood your second post.
Taking a closer look at your formatting, these are pre-processing templates so you still need the follow the rules just as if this was PDF doc generation template.
The IF needs to have an “endif” and the START needs to have an “end”. Links below to articles for examples.
***************************************
Unfortunately, after reading another thread (here) I think you might still have an issue UNLESS the problem of the extra column after an “endif” was resolved. You may want to try it out anyway.
There was this comment:
”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.”
It sounds like the person was able to use a REGULAR If expression instead of a template based one.
****************************************
Once you have that format sorted out, I understand that you are partly using the IF to decide if a comma is inserted or not. But I would suggest something more like this:
I saw your post in MultiTech’s thread. Your issue is a little different.
Did you by chance try implementing the IF formatted like an AppSheet IF expression instead of a template based IF? The older post I linked seemed to imply that fixed (worked around) the problem.
Can you try this approach again but instead place the “}” on its own line adn then the “End” on the next line after that? I believe “End” ’s must be on a separate row unless it is in a table such as a Doc table.