Good afternoon,
I’m looking for ideas/help on how to export a list of things as formatted text. In particular, I want to export specific fields of a list of things in to a paragraph for the purposes of sharing.
The scenario:
In my app, each user can have a number of “Collections”. Each of these Collections has a list of "Item"s. Each Item has fields for Name (text), required), Brand (text, required), and Variation (text, optional), as well as several other fields which aren’t really important other than to clarify that I don’t actually want to export the ENTIRE item.
A user may have a desire to share the collection. While they can share a link to the collection, suppose that the forum that they’re sharing the collection on has strict rules, and they need to be able to list the items in formatted text.
The problem
I want to be able to generate a text from a given Collection’s Item list. Assume a user has a Collection with the following Items:
[
{
Name: “Alpha”
Brand: “Acme”
},
{
Name: “Beta”
Brand: “Acme”
Variation: “V1.0”
},
{
Name: “Beta”
Brand: “Acme”
Variation: “V2.0”
},
{
Name: “Gamma”
Brand: “Bravo Corp.”
Variation: “Red”
}
]
The text should be formatted as such:
Acme Alpha
Acme Beta: V1.0 and V2.0
Bravo Corp. Gamma: Red
My attempts thus far
The closest I’ve been able to come so far is using a repeating group with the data source set to the list of products sorted by Brand, Name, and Variation and then having a text field on each which displays the data formatted. However, this has two issues.
- I can’t seem to access a cell’s contents from outside the repeating group, so I can’t concatenate the results together
- This approach doesn’t allow me to merge Items with the same Name and Brand together so that Variations can be formatted as above.
Any suggestions would be helpful. This is one of those cases where it would be trivial if I had the ability to directly manipulate the list programmatically, but alas I don’t.