How to combine lists into one?

Iโ€™ve got 3 enumlists in different tables that I need to combine together in an enum on another table for itโ€™s options.

So tableโ€™s A, B, and C have lists of email addresses that people can choose from.
In table D - all those emails need to be available as options in an enum.

Iโ€™ve got the following formula, but itโ€™s not parsing things as I need:

split([notification_patient_facility].[notification_emails] + HCAs[HCA_Notification_Email_Options] + Hospitals[Hospital_Notification_Email_Options], โ€œ,โ€) - list("")

this gives me the following:

The first element of the list ([notification_patient_facility].[notification_emails]) is split into options, but the imported table options (HCAs[HCA_Notification_Email_Options] + Hospitals[Hospital_Notification_Email_Options]) are imported as a โ€œlist-option.โ€

I tried not including the SPLIT(), but then it was just a list of lists. Iโ€™ve also tried different split denominators: " , " (space, comma, space) and ", " (comma, space) - but all result in the same thing with the two table imports being list-options.

I also tried wrapping the whole thing in ANOTHER split, but it resulted in the same thing again (curiously).

@Aleksi help!!! (^_^)

Solved Solved
5 20 4,243
1 ACCEPTED SOLUTION

So to finalize everything and provide an answer to anyone looking at this string:

If youโ€™re trying to use a โ€œlist of listsโ€ as options for a dropdown - wrap it in a CONCATENATE() and SPLIT() by the comma, this gives you a list of your options in the correct format.

From there you can use that list in any normal way: as part of a formula or combine your lists into one; itโ€™s all about transforming the data into the appropriate type.

TableA[Enumlist_A] + TableB[Enumlist_B]

would need to be:
SPLIT(CONCATENATE(TableA[Enumlist_A]), โ€œ,โ€) + SPLIT(CONCATENATE(TableB[Enumlist_B]), โ€œ,โ€)

View solution in original post

20 REPLIES 20

Iโ€™ve been looking at the data types:

the first is a legit enumlist
the second and third and lists of enumlists.

Thatโ€™s why the first one parses out correctly, but the others are pulling in each row as an option.

I tried splitting the second options in part of the list combination:
[notification_patient_facility].[notification_emails] + SPLIT(HCAs[HCA_Notification_Email_Options], " , ") + SPLIT(Hospitals[Hospital_Notification_Email_Options], " , ")

But itโ€™s resulting in the same thing.

ALSO: Just tried wrapping the whole thing again:
SPLIT([notification_patient_facility].[notification_emails] + SPLIT(HCAs[HCA_Notification_Email_Options], " , ") + SPLIT(Hospitals[Hospital_Notification_Email_Options], " , "), โ€œ,โ€)

but itโ€™s always resulting in the same thing.

What does CONCATENATE([notification_patient_facility].[notification_emails] + HCAs[HCA_Notification_Email_Options] + Hospitals[Hospital_Notification_Email_Options]) look like?

Resulted in an error. canโ€™t have a concatenate in the valid if (or the suggested values).

I moved the formula from the valid if to the suggested values, so others could be added, and you see the list of list much better:
1X_bea29bb99d5412a53e2e7d0c1b47e70532c88f73.png

How about a new VC with that value? Iโ€™m interested to see if thereโ€™s something in the merged list and lists of lists that would interfere with SPLIT().

Unfortunately this is a live app, with active users and a TON of data, so something like that is out of the question.

I was thinking it might be something about the delimiter I use in the SPLIT, thatโ€™s why I was trying different things. To date Iโ€™ve tried:

โ€œ,โ€
", "
" , "

But each results in the same thing, seems the system ignores the spaces and just uses the comma.

Wouldnโ€™t surprise me if the list-of-lists is introducing a problem. Is that a construct youโ€™ve used successfully in the past?

Itโ€™s always been a problem. Iโ€™ve never been able to successfully solve it, usually I find another way to bring about the behavior Iโ€™m looking to create.

You could create but not save (or delete before save) the VC just to get into Expression Assistant.

The problem here is that you canโ€™t tell how things are split in the previous page; the rendering element that makes what we see in the testing page doesnโ€™t split things differently - each item is separated individually.

But when you open the app with the things saved, thatโ€™s when you see the items of the lists for what they really are:

If you compare the two pictures, you can see where things are split in the testing page - but thereโ€™s no way to actually tell by that unless you can see it elsewhere.

A Valid_If expression of the form:

[notification_patient_facility].[notification_emails]
+ SPLIT(HCAs[HCA_Notification_Email_Options], ",")
+ SPLIT(Hospitals[Hospital_Notification_Email_Options], ",")

seems to works for me. ๐Ÿ˜•

*Thereโ€™s nothing in the โ€œ[notification_patient_facility].[notification_emails]โ€ for that picture, just shows the result of the splits.

@Aleksi filtering duplicates yes, also filtering blanks.

So each item in the HCAs[HCA_Notification_Email_Options] List is not itself a List, but merely Text containing a comma-separated list of email addresses?

What is each item in [notification_patient_facility].[notification_emails]?

The column itself is an actual enumlist, meaning a single column from the facility table containing a list of emails.

[HCA_Notification_Email_Options], the column in the HCAs table, is itself an enumlist (containing a list of emails).

So โ€œHCAs[HCA_Notification_Email_Options]โ€ is a list of those lists.

[notification_patient_facility].[notification_emails]
+ SPLIT(CONCATENATE(HCAs[HCA_Notification_Email_Options]), ",")
+ SPLIT(CONCATENATE(Hospitals[Hospital_Notification_Email_Options]), ",")

hmmโ€ฆ that might work.

and indeed it did!


you the man! @Steve

Hooray!

So to finalize everything and provide an answer to anyone looking at this string:

If youโ€™re trying to use a โ€œlist of listsโ€ as options for a dropdown - wrap it in a CONCATENATE() and SPLIT() by the comma, this gives you a list of your options in the correct format.

From there you can use that list in any normal way: as part of a formula or combine your lists into one; itโ€™s all about transforming the data into the appropriate type.

TableA[Enumlist_A] + TableB[Enumlist_B]

would need to be:
SPLIT(CONCATENATE(TableA[Enumlist_A]), โ€œ,โ€) + SPLIT(CONCATENATE(TableB[Enumlist_B]), โ€œ,โ€)

@MultiTech_Visions Do you need to filter duplicates away or is there any?

Thank you for this thread , your great idea will save me days of work.

I am trying to create an enum selection from a text cell containing words divided by "," . 

It shows fine in app the enumlist, for selections , but after I select my options , the column is still blank when I hit Done. 

Any tips? 

This is my formula to create the enumlist

split(concatenate(SELECT(x tech options[neconformitate], [_THISROW].[serie doc] = [serie doc]));",")

This is my testing table from wich I gather the options

OptimiX_XcrY_0-1672252430225.png

They show up fine :

OptimiX_XcrY_1-1672252463883.png

and blank when I hit done(gata)

OptimiX_XcrY_2-1672252487851.png

Thank you

Solved by making the formula :

 in([_this];split(concatenate(SELECT(x tech options[neconformitate], [_THISROW].[serie doc] = [serie doc]));",")) . 

Don't yet understand it , but i read the troubleshoot from https://support.google.com/appsheet/answer/10107949?hl=en

Top Labels in this Space