How to flatten a list of lists?

Good afternoon, Everyone:

I created an Address Book app. Each Contact can have multiple Email Addresses. In the Contact Details table, I created a VC called Related Contact Email Addresses By ContactID of type List. AppSheet graciously populates that field as Email Address records are added and associated with a Contact.

Things were moving smoothly until I saw that Email Address records became orphaned whenever I deleted a Contact without first deleting Email Addresses. Granted, orphaned records donโ€™t negatively impact the appโ€™s operation, but I find it distasteful from an esoteric point of view

My current solution works, but it is not efficient. I created an Action called Delete All Email Address Records referenced by Contact Detail Record. Here is a screenshot:

Iโ€™m unsure how AppSheet executes the SELECT, but the worst case scenario is that it is a linear, brute force search. That will slow down as more Contacts and Email Addresses are added.

Well, then I thought why canโ€™t I leverage the existing โ€œRelated Contact Email Addresses By ContactIDโ€ in the Contact Details table? All of the EmailAddressIDโ€™s are right there, courtesy of AppSheet. So, I changed the Action to this:

However, I receive an error saying, in effect, that the result of the SELECT is not a list. It wonโ€™t tell me what it returns, but I suspect that it is a List of Lists.

Is there a way to flatten it?

Thank you,
Brian

Solved Solved
0 2 376
1 ACCEPTED SOLUTION

Steve
Platinum 4
Platinum 4

For Referenced Rows, try just:

[Related Contact Email Addresses By ContactID]

View solution in original post

2 REPLIES 2

Steve
Platinum 4
Platinum 4

For Referenced Rows, try just:

[Related Contact Email Addresses By ContactID]

@Steve

Amazing! How simple was that!

Thanks,
Brian

Top Labels in this Space