Hi all,
I am trying to generate a PDF from a GoogleDocs Template.
I have 'Products' cells that contain a list of products, each product is on a different line.
Each line in the Products should generate on a separate label. \n is used as the delimiter.
Repeat error, any help would be appreciated. Is this even the correct approach?
Label template:
<<Start: SPLIT([Products], "\n")>>
Label: <<[This]>>
<<End>>
Products Sample:
516 Gold Plated Impression Pendant โ Small
516 Gold Plated Impression Pendant โ Small
516 Gold Plated Impression Pendant โ Small
516 Gold Plated Impression Pendant โ Large
516 Gold Plated Impression Pendant โ Large
516 Gold Plated Impression Pendant โ Large
516 Gold Plated Impression Pendant โ Large
516 Sterling Silver Impression Pendant โ Medium
"\n" is a non-visible designation for a newline character in many source code languages. Are you explicitly inserting the text "\n" into the text string?? AppSheet doesn't recognize "\n" as a newline character. See the expression below on how to handle newline characters as the delimiter.
A little more background in how the "Products" cell is being used overall and defined in the app might be needed. E.g. why isn't it defined as a REF type column to begin with??
The START function in a template MUST supply a list of ROW KEYS as defined in the AppSheet app. You "Products Sample" list seems to imply you have a list of Names. If so, you can adjust your START expression like this:
<<START: SELECT(Products[Key], IN([Product Name], SPLIT([_THISROW].[Products], "
")))>>
NOTE: The above expression assumes [Products] is defined as type of LONGTEXT and are NOT actual REF values. Notice how the newline is handled by typing in the actual "return" key forcing the expression to the next line.
NOTE2: I don't recall if a template can handle the newline character as shown above. If it doesn't then you can deal with that by adding a Virtual Column in the app named maybe "Products List", type of List to Products table and assign it the SELECT() expression as shown (or similar). Then you can use that Virtual Column in your template like this:
<<START: [Products List]>>...
I hope this helps!
Thankyou for your reply.
I have an app script that processes order metadata and calculates quantity and repetitions and then displays each single repetition as a new line (seperated by \n) in the Products Column.
Product Input prior to app script:
Gold Plated Impression Pendant - Small, Three Pendants × 1, Gold Plated Impression Pendant - Large, Two Pendants × 2, Sterling Silver Impression Pendant - Medium, One Pendant × 1
Is there a recommended delimiter?
Products is simply text instead of static references to rows in another table.
User | Count |
---|---|
16 | |
15 | |
4 | |
3 | |
2 |