Does a <> expression output a comma between every record? That seems to be what is going on with mine, but I do not want that comma to be there. Is there some way to get rid of it?
Iโm outputting code for an HTML table
<<Start:Riverside Tanks[Name]>>
<<[Name]>> <<[Label]>> <<[Status]>> <>Hmm, where do you see the comma? Can you attach a sample of the result you are getting?
I suggest creating a workflow template that looks like the one described in topic โCustomer Template in Table Formatโ in this article help.appsheet.com - Email Templates
If you prefer, you can use Microsoft Word rather than Google Docs to create the template.
This approach is known to work and it avoids the need for you to hand create the HTML for
a table.
Email Templates help.appsheet.com
I am currently testing. Something weird seems to be going on, hopefully Iโll figure it out soon. The comma is between records output from the <> expression.
Thank you @Philip_Garrett_Appsh, but I am trying to do something that that wonโt work for.
I believe I figured out the issue. It is important to know that I am attempting to output a long string of html code, as an attribute
in a JSON string being sent out in a webhook. That means I want all the html enclosed in quotes, and then along with a few other items, enclosed with curly braces { }. It seems that when you put a <> expression inside of curly braces, the commas get automatically inserted between record outputs.
{<<Start:Riverside Tanks[Name]>><<[Name]>><>}
outputs:
{FV1,FV2,FV3,FV4,FV5,FV6,BT1,BT2}
Whereas
<<Start:Riverside Tanks[Name]>><<[Name]>><>
outputs:
FV1FV2FV3FV4FV5FV6BT1BT2
For my purposes (building a table in html code), the commas severely mess up the formatting. Is it a purposeful design for the commas to be automatically inserted between records when creating a JSON string? I suppose that could help in some circumstance, but I certainly would not expect it to happen.
@Aleksi_Alkio Can you comment on the difference in outputs in the above reply?
@Marc_Dillon You are correct. We detect that the template contains JSON because the template starts with the { character. When we replace the values between the <> and <> in a JSON template, we insert a comma between consecutive JSON elements.
I am not sure what to recommend to you to circumvent that.
Thanks for the response Philip. Is this behavior documented anywhere? Personally I would not expect this to happen, I feel the user should be responsible for including a comma where it is needed, especially since it does not happen in the other webhooks. JSON expects quotations around every value yes? The user would have to manually include those in their template, how is that different than commas between records?
Since I am receiving the webhook in a script, I have been able to easily replace all commas with a blank string. That is simple in this case because there are no intentional commas in the string.
It would be quite a bit mote difficult if there were.
Ah, yes, that makes sense. Iโve no suggestion at this time. Thanks
It is hard for the user to include a comma between JSON entries without also including a comma after the last JSON entry. By including the comma automatically, I can trim the extra trailing comma following the last JSON entry.
If we had richer syntax that allowed the user to include the comma for all but the last JSON entry, we could leave comma insertion up to the user. Unfortunately, there is no such syntax at the moment.
I am open to better suggestions.
Thank god I found this thread. I was searching for this for an hour.
<<START: LIST>>{JSON Stuff}<<END>>
outputs:
{JSON Stuff}, {JSON Stuff}, {JSON Stuff}
Hardcoding the comma within the start, unless this was a bug of the past:
<<START: LIST>>{JSON Stuff},<<END>>
(ala the example here: https://help.appsheet.com/en/articles/3454117-json-webhook-templates)
ends up triggering an error, because the comma ends up showing on every entry and Discord, in my case, explicitly refuses it. (I have not retested this in like 6 months)
For anyone else that looks for JSON related stuff in the future, I just wanted to add to this old thread.
I am also running into trouble getting my JSON body to work with if statements as they always seem to add a comma after the content the if statement returns.
For example;
{"envelope_title":"<<[Company Name]>> - <<[Product]>>",
"envelope_documents":
[
{"document_title":"Sales Contract- <<[Company Name]>> - <<[Product]>>",
"document_url":"<<[Contract Link]>>"}
<<if:(isnotblank([File 1])=true)>>
,
{"document_title":"Supporting Document 1",
"document_url":"<<[File 1 Link]>>"}
<<endif>>
],
"envelope other stuff: blah blah"
}
When the if statement is true, it returns the information but gives me a " },], " at the end of it, when it should just be " }], "
Is there any way around this or a way to write this better?
User | Count |
---|---|
16 | |
10 | |
8 | |
5 | |
5 |