Formula function for comparing two lists of texts

I’m trying to create a recommended section from a repeated data resource that is filtered based on a set of user preferences.

I’ve got an app variable with two different lists of texts that represent users interests and topics. These are populated based on selected interests from the user during initial sign-up.

Later on, I’ve got a repeated data resource that has a property called “tags” with the schema of a list of texts.

I’m trying to filter the repeated list by matching the tags property of each item in the repeated list with the two lists of texts the user has selected earlier.

Any idea what is the best formula as I’m struggling to create a formula that compares lists of texts?

I’ve watched @Mevi 's YouTube tutorial on creating tag inputs, but the formulas don’t quite line up as the use cases and schemas are different.

Hi, I think this Formula should work or should be very close at least:

MAP<mapped>(SELECT<selected>(data.tags, IS_IN_ARRAY(appVars.interests, item) || IS_IN_ARRAY(appVars.topics, item)), {tag_name: mapped})

If it helps in future cases, I’ll try open my thinking here a little.

  • First I identify what we want to repeat in the list -> tags in this case -> SELECT works well in most cases when we’re just limiting part of the data to be used in a repeat
  • What the single item in tags should look like to be part of the outcome -> Here it has to be part of user’s interests or topics -> IN_IN_ARRAY works because it’s List of Texts (with List of Objects we’d use IS_IN_ARRAY_BY_KEY)
  • Now we have the correct tags as List of Texts in hand, but we can repeat only List of Objects -> MAP works well when modifying our items to different format (or when adding new data to items) -> Use it to make the Texts into Objects with the property name of choice: tag_name
  • Little work is still needed, because now we have two Formulas that go through all items in in a List and use item. syntax, so we need to differentiate the name references of MAP and SELECT -> I chose just mapped and selected here

Hi Tomi,

I’ve been puzzling for a couple of hours but can’t solve my problem.
I have connected by REST API two different database tables, one table has items (cards), each card has text and topic (unique id), second table has items (topics), each topic has name and id (same unique id as in cards), I want to show cards in the list and all cards show properly, but I can’t show write topic name on each card (depending on this card). I tried to use IS_SAME, IS_IN_ARRAY, SELECT_BY_KEY and many other things but had no luck. How can I compare two properties from current repeated data item and data variables and show property of only found?

Thank you in advance.


I’m not sure I understand you correctly, but I think you need to use two SELECTs within each other to get this sort of an effect, or SELECT and SOME. Something like SELECT<card>(data.Cards, SOME<topic>(data.Topics,

Hey Mevi, many thanks for your reply, I spent a lot of time for understanding multiple formulas at once, but finally I have right formula according to your advice: FIRST_ITEM(SELECT(data.topics, item._id==current.Topic)).Name.

1 Like