Does a <<Start>> expression output a comma be...

expressions
(Marc Dillon) #1

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]>> <>
(Reza Raoofi) #2

Hmm, where do you see the comma? Can you attach a sample of the result you are getting?

(Philip Garrett) #3

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

  1. Create a Google doc with a single row table having three columns. (If you want a table header row then create a two row table and put the header labels in the cells of the first row.) 2. In the left most data row cell enter: <<Start:Riverside Tanks[Name]>> <<[Name]>> 3. In the center data row cell enter: <<[Label]>> 4. In the right most data row cell enter: <<[Status]>><> 5. After you create the template, open the workflow rule in the Editor. 6. Click the “document icon” for either the Email Body Template or Attachment Template and navigate to the Google docs template you created above.

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

(Marc Dillon) #4

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.

(Marc Dillon) #5

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.

(Marc Dillon) #6

@Aleksi_Alkio Can you comment on the difference in outputs in the above reply?

(Philip Garrett) #7

@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.

(Marc Dillon) #8

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.

(Marc Dillon) #9

Ah, yes, that makes sense. I’ve no suggestion at this time. Thanks

(Philip Garrett) #10

@Marc_Dillon

Sorry I don’t have a better suggestion.

Glad you found a work around!

(Philip Garrett) #11

@Marc_Dillon

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.