How to display EnumList values in separate rows

I have an EnumList that is displayed in emails but items within the list needs to be in separate rows, will that be possible?
example the items selected are Apple, Banana, Orange
result is as shown above but we want it to show as below:
Apple,
Banana,
Orange

Solved Solved
1 15 1,549
1 ACCEPTED SOLUTION

Convert your Enmlist type column to other value using VC with expression like this.

substitute(
[EnumList]," , ",
"
"
)

Then use that VC within your workflow template.

View solution in original post

15 REPLIES 15

Convert your Enmlist type column to other value using VC with expression like this.

substitute(
[EnumList]," , ",
"
"
)

Then use that VC within your workflow template.

Thank you very much Koichi san for the brilliant idea!
That solved the problem.

not working on template unfortunately @Koichi_Tsuji

I'm currently using this function to list elements from an ENUM list on separate lines in AppSheet:

Now, I would like to number these list items. How could I prepend each item with an incrementing number?

1. Element 1
2. Element 2
3. Element 3

is this possible?

 


@Rezai wrote:

Now, I would like to number these list items. How could I prepend each item with an incrementing number?

1. Element 1
2. Element 2
3. Element 3

is this possible?


Yes, but depending on where you need to see the data - it can pose more difficulties.

LongText (HTML)

If you're fine with turning on the beta features, and using them, the Rich Text support for LongText columns is pretty good.  

Aside from a few issues with text spilling past the edge of the screen... everything else seems to be working solidly. 

You can create a longtext column, turning on the HTML rich text support in the settings for the column, and use an app formula to take your list and turn it into an ordered list.

concatenate(
"<ol>
  <li>", 
  substitute(
  	YOUR_LIST_HERE, 
    " , ", 
    "</li>
  <li>"
  ), 
  "</li>
</ol>"
)

Preparing Ahead of Time

If you can't use the beta feature, then it get's a bit more complicated; you have to prepare the list item ahead of time on each child record, then on the parent make a list of those items.

On the Child:

Concatenate(
  [COLUMN_WITH_ITEM_NUMBER], 
  ". ", 
  [COLUMN_WITH_ITEM_LABEL]
)

This creates the individual line items for your list; the number, the period and space, and your text - all in one string.

On the parent (or wherever you need to display the list):

Substitute(Concatenate([Related WHATEVERS][COLUMN_WITH_LIST_ITEM_FROM_CHILD]), " , ", "
 "
)

This creates the actual multi-line display that users can see (or you can use wherever, as it's technically a multi-line string.

-------------------------------------------------------------------------------------

For other examples of regular bullet points, you might check out a sample app I put together awhile ago:

https://www.appsheet.com//templates/An-app-to-demonstrate-what-a-bulleted-list-from-an-EnumList-look...

-------------------------------------------------------------------------------------

You can also find some additional info in the Answer Portal under Resources & Tools > How To > Ordered List

Thanks,

Can you help with this, I want to print enumlist values in the form of a list on the google doc template. @Steve @Koichi_Tsuji @WillowMobileSys @Joseph_Seddik 

Make sure the VC that @Koichi_Tsuji suggested above is defined as LongText.  It will retain the line breaks in a template.

Ahh my fault๐Ÿ˜, I used it as text, now I made longtext, problem solved. Thank you.

I'd like to avoid the VC method , for performance reassons.

 

I have set the enumlist column to LongText base type , and used in the google doc template the substitute formula. But the resulting pdf  doesn't display in separate rows.

<<if(isnotblank([x1]);concatenate(โ€œ- โ€œ;substitute( [x1];" , ";
"

- "));list())>>

Any other suggestions please?

 

Thank you

It doesn't look like the syntax of your expression is correct.  Test it in a column first until you get the data showing like you want in the app field.  Then try shifting it into the template. 

NOTE:  templates have their own IF function.  I don't think you can use an app type IF expression - but I have never tried.  Using IF expression in templates

A couple other things...

  • I have not tried to insert line breaks with an expression in the template, so I am not certain if it will behave the same way.
  • Virtual columns DO have their place.  Performance impacts are from situations where the column needs to access a set of rows to determine its resultant value.  Your expression above should be perfectly fine as a Virtual Column.  Of course, if there are a LOT of these insignificant VC's they could add up. 
  • Personally, in this case, if I couldn't handle it in the template, then I would add a "normal" table column and use an App Formula.

Thanks you,

The If formula works in templates , and I like it.

1000119849.png

โ€ƒ

1000119850.png

โ€ƒ

The substitute works in a VC too, but not in the template, even if i simplify it to 

<<substitute([x1];" , ";"
")>>

Indeed , I don't know how to insert a line break , but if a VC column with line brakes can be "pasted" in a pdf generated from template , makes sense to be possible this way too.

 

 

Thank you for that.  

I do seem to recall a prior post where someone couldn't get line breaks to occur in the template.  It seems to me you have no choice but to use a table column.

Probably this one , and I'm reading it now.

https://www.googlecloudcommunity.com/gc/AppSheet-Q-A/Substituting-line-breaks-in-email-template/td-p...

 

The substitute works in email body templates ,but not in attachment templates

 

If your original values are a LIST of Ref's, then the solution in that article will work.  If the EnumList column was one where you manually inserted the choices into the EnumList column definition directly, then the article solution will NOT work.

HOWEVER, you could place your EnumList choices into a small utility table, use that table as a Ref to pull in the choices for your EnumList column AND also use that table for the solution in the article to place your EnumList choices on individual lines.

Top Labels in this Space