Best approach to implement searchable array of text

Tap Forms – Organizer Database App for Mac, iPhone, and iPad Forums Using Tap Forms Best approach to implement searchable array of text

Viewing 3 reply threads
  • Author
    Posts
  • September 20, 2020 at 4:46 AM #41993

    Antonio Calanducci
    Participant

    Hello,

    I am finding the best way to model a fields (for example tags) that could have multiple values (array), and that I would be able to search on one of the array values.
    Currently I have found to approaches:
    – using a field of type table, but as far as I have found, I cannot search on the values of a table fields (please correct me if I am wrong)
    – using a text fields, associated with a multi-value popover. When I select the values, it merges them in a single, comma separated, text fields, but then I cannot make a search on a single value

    Imagine for example I want to model a tags field, where the user can input a variabile number of words (and maybe he can choose them from the list of the previous inserted ones with autocompletion), and then later I want to make a search for the records with a given tags
    Or an “actors” fields, and a search on all the movies with a given actor

    I probably could use a Linked form, but as I know that TapForms use under the hoods Couchbase lite, that natively supports array I am wondering if there is an easier approach

    thank you

    September 20, 2020 at 11:51 AM #41995

    Sam Moffatt
    Participant

    I would set up a tag form and use link to form field with the M:M setting to join it together. Then you can use the tag form to find linked records with that particular tag.

    That said I would have expected the saved search system to have worked to pick out an individual tag from a field. Perhaps I misunderstand the requirement there.

    Keep in mind whilst it’s built on top of CBL, TF has its own data model on top of it. CBL itself is built on top of SQLite as well, layers on layers!

    September 21, 2020 at 12:52 AM #42001

    Brendan
    Keymaster

    Hi Antonio,

    One other option is if you need to search for an exact value, put it in double-quotes in the search field.

    So if your multi-valued popover powered field has the following values in it:

    The Terminator, Terminator 2: Judgement Day, Terminator Salvation

    Then to search for Terminator 2: Judgement Day, just put that in double-quotes in the search term:

    "Terminator 2: Judgement Day"

    Then you’ll get an exact match for that phrase.

    But Sam’s suggestion to use the many-to-many Link Type on a Link to Form field is also a good one too. It all depends on how you want the data visualized. A Link to Form field displays the relationship as a table with multiple sub-fields. A Text field with a Pick List just displays the values comma separated within the field (as you’ve discovered).

    October 3, 2020 at 11:09 PM #42108

    Sam Moffatt
    Participant

    I ended up turning this one into another YouTube video on Link to Form fields that might be helpful as well.

Viewing 3 reply threads

You must be logged in to reply to this topic.