Appsheet API Preset iterate through enumlist in JSON start expression

Ha.. I hope my title catches the right person's eye.

Here is the JSON body. This works until it doesn't. Explanation to follow. If there is a better/less fragile way to accomplish this, I'd love to know how.

 "Rows": [
<<START:[ValueListName]>>
{
"SelectedItems":"<<[ValueListName]>>"
},
<<END>>
]

Tables

ListOfValues

Column: ValueListID (Text) - key and label
- Manually entered values: Item #1, Item #2, Item #3

BuildPlacedValues

Column: BuildPlacedValueID (Text) - key and label
Column: ValueListName (EnumList) - Ref type to ListOfValues table. Valid if: ListOfValues[ValueListID]

PlaceValuesHere

Column: PlaceValuesID (text) - key and label
Column: SelectedItems - Ref to ListOfValues table.

Bot Automation

When a record is added to the table: BuildPlacedValues, you can select between 1 and n values in the Enumlist field: ValueListName 

Upon save, the bot runs through the start expression above. It iterates through the list of items in: ValueListName and adds a row for each selected item to the table: PlaceValuesHere.

This works but...

This is working in multiple project. I'm unsure how Appsheet knows to break out the individual values for each row as I'm referencing the Enumlist field in the start expression and then in the JSON key value pair.

But... when the values selected are email addresses, it does not break out the values and instead places all values select on each row added.

So, if there were three email addresses select, it adds three rows but each row has all three email addresses, comma separated. Because this is a REF field, it cannot link to the REF table.

Additionally, once broken, I cannot change it back to the prior values and recover the functionality. If I change the ListOfValues[ValueListID] back to what they were, it still adds all selected values to each line created in the resulting table.

I hope this makes sense and hope there is a solution to this.

Thanks.

 

 

Solved Solved
0 1 100
1 ACCEPTED SOLUTION

Solved it.. A select using the list of selected values.

"Rows": [
<<START:SELECT(ListOfValues[ValueListID],IN([ValueListID],[ValueListName]),FALSE)>>
{
"SelectedItems":"<<[ValueListID]>>"
},
<<END>>
]

 

View solution in original post

1 REPLY 1

Solved it.. A select using the list of selected values.

"Rows": [
<<START:SELECT(ListOfValues[ValueListID],IN([ValueListID],[ValueListName]),FALSE)>>
{
"SelectedItems":"<<[ValueListID]>>"
},
<<END>>
]

 

Top Labels in this Space