One item per line in a PDF file from an Enum List.

I use a bot to create a PDF file of the table "Budgets".

The PDF shows all items of the "Labor" column in one line (see next image).

AppSheet 1.png

Is it possible to have one item of labor per line as shown below?

AppSheet 2.png

This is the "Budgets" form.

AppSheet 5.png

 

This is from where I select the "Labor" items.

AppSheet 3.png

 

The column "Labor" is a Enum List.

AppSheet 4.png

 

Here is the "Budgets" table.

AppSheet 6.png

 

Any idea will be welcome.

Solved Solved
0 17 226
1 ACCEPTED SOLUTION

It works for me..

TeeSee1_0-1709597575364.pngTeeSee1_1-1709597612504.png

TeeSee1_3-1709597709686.png

 

TeeSee1_2-1709597639448.png

 

 

View solution in original post

17 REPLIES 17

One way you could try is to create a VC with an expression like

SUBSTITUTE([Labor], ", ", "
")

and print this VC. (note the space and carriage return in the expression).

Using the SUBSTITUTE formula directly in the template does not seem to do the trick...

Thank you for your response @TeeSee1.

I tried it, but it only replaces the comma with a space.  This is what I get when testing the VC. 

AppSheet 7.png

And this is the PDF.

AppSheet 8.png

Does AppSheet has a escape sequence for a carriage return in order to write it into a formula?

An alternative to try with no guarantee it will work:

SUBSTITUTE([Labor], ",", CONCATENATE("
"))

Thank you @Markus_Malessa.

It works in the VC, but not in the PDF ☹️ .

AppSheet 9.png

Is the VC's sole existence to test the functionality of what I proposed, or do you have a need for the VC regardless? If you have the VC regardless, then in your template have you tried just placing the VC column rather than the full expression? I have had luck with using line breaks in VCs and then using the VC in my template and it actually observes the line breaks if they are present in the VC.

I use the VC in order to test, but if it works, I'll use it.

This is the VC.

AppSheet 10.png

 

This is the expression.

AppSheet 11.png

 

This is what I have in the template.

AppSheet 12.png

 

This is the result.

AppSheet 13.png

What do you recommend?

Interesting. I don't think that what I suggested actually observes the line break. Then again, where I have used this I actually use & for concatenate rather than the formula. In that case, I am wondering if you should change the expression some. Try the following directly in your template first, then switch it to the VC and try the VC in the template if it doesn't give the desired results.

SUBSTITUTE([Substitute Piezas], ",", & "
" &))

The Enum column that has the list of items is called [Piezas].  It's a non virtual column.  The VC is called [Substitute Piezas] and has the formula "Substitute".

I replaced [Substitute Piezas] with [Piezas] but I get this error.

AppSheet 14.png

What am I missing?

 

Might have to try it this way:

SUBSTITUTE([Piezas], ",", "" & "
" & ""))

The formula is Ok.

AppSheet 15.png

Now I'm gonna try it.

In the last screenshot I had the column [Substitute Piezas] in the formula.  The correct column is [Piezas].

This is the formula I'm using in the VC [Substitute Piezas].

AppSheet 16.png

It sends no value and the scripts can't create the PDF.

Is it possible to achieve what I'm looking  for?

What do you mean the script can't create the PDF? Here is an example I did real quick. My use case is an EnumList column with subtype of REF. Using the following I was able to get the VC to display on separate line items inside the detail view. Then if you use <<[YourVC]>> in your template it should also observe the line breaks.

SUBSTITUTE([RefEnumListColumn][ColumnNamefromRefTable], " , ", "" & "
" & "")

Markus_Malessa_0-1709592221099.png

 

I have other apps creating PDFs using a bot that triggers an apps script and the script creates the PDF, but this is not the case. Sorry for the confusion.

In my first post, I showed details of my EnumList colum (see below). I use a Base type = Text and a Valid if = Labor [Labor]

AppSheet 4.png

As you can see, it's different from the one that you describe, because your Base type is Ref.

I'm going to follow your instructions, and I'll let you know.

 

 

I'll have to take another look at my other project which is under a different google account. I know that I do not use substitute in that project for line breaks but I do take a virtual column that creates line breaks with concatenating using the &. However, the main difference might be that I use a HTML template and that is why it might observe the line breaks correctly. I tried a few ways of using an attachment PDF in an email to create line breaks without success.

It works for me..

TeeSee1_0-1709597575364.pngTeeSee1_1-1709597612504.png

TeeSee1_3-1709597709686.png

 

TeeSee1_2-1709597639448.png

 

 

I got it!

It was not working because the VC was a Text column type. I changed it to Long Text and voila..!

I could see in the last post of @TeeSee1 that the type of the VC was "Long Text".  AppSheet was setting this column as a "Text" type column, so I changed it from "Text" to "Long Text" as shown below.

AppSheet 17.png

This is the expression.

AppSheet 18.png

And this is the PDF.

AppSheet 19.png

Thank you very much @Markus_Malessa and @TeeSee1. I appreciate your time and effort.

Top Labels in this Space