8 Replies Latest reply on Mar 22, 2013 12:53 PM by marksealey

    Hierarchical tags



      Hierarchical tags



           How would forum members suggest I implement hierarchical tags in FMP 11, please?

           A Find should return results for, say, 'Lion' because 'Lion' is a tag I've added conceptually under 'Wildcats', where 'Wildcats' itself is under 'Cats (etc)'.

           Incidentally, I'm right to think that the preferred way to tag records is in a single field, multiple tags; and not multiple fields ('Tag 1', 'Tag 2', 'Tag 3' etc), aren't I?


        • 1. Re: Hierarchical tags

                    A Find should return results for, say, 'Lion'

               A find specifying what criteria would find results for lion?

               Specifying a find using the criterion "Cat"?   cats > wildcats > Lion ?

               This would probably require tags in related records rather than in a single field or multiple fields.

          • 2. Re: Hierarchical tags

                 Well, I'm imagining something different from what you've kindly suggested, thanks, PhilModJunk.

                 Assuming four records for four different 'pets':

            Pet's name                                tag

                 Maxiimillian                             lion

                 Priscilla                                     cat

                 Neville                                    wildcat

                 Jessica                                     tiger

                 where one conceptual hierarchy is animal > cat > wildcat > lion

                 and the other is animal > cat > wildcat > tiger

                 such that a search for 'cat' will return all four records - not because they're all tagged as such (in fact only Priscilla is).

                 But bcause all lions, tigers, wildcats (and, for that matter all cats, of course!) are cats.

                 Or indeed such that a search for 'animal' will return all four since tigers, cats, lions and wildcats are all conceptually/in the (elsewhere defined?) hierarchy of animals

            • 3. Re: Hierarchical tags

                   I don't see any difference in your last post and what I described in my preceding post.

                   Specifiying Cat as your search criterion should find all 4 records because the specified tags are all members of the "cat" set. The hierarchy basically defines sets and subsets of the different tags.

                   And I think that a set of related records to document such tag hierarchies would be the way to produce and manage such a thing.

                   Essentially, you'd perform a search in the tag table for "cat" and then all the records in your example would be found as related records that link, however indirectly, to that "cat" record with "cat".

                   That gives us a conceptual model of what you want to do, but the devil will be in the details.

              • 4. Re: Hierarchical tags

                     So a Tags table with its records each containing grandparent > parent > child > grandchild etc:

                Primary Key                                     Tags field

                     tiger                                       tiger, wildcat, cat, animal

                     lion                                        lion, wildcat, cat, animal

                     wildcat                                  wildcat, cat, animal

                     cat                                         cat, animal

                     animal                                  animal


                • 5. Re: Hierarchical tags

                       Not what I had in mind.

                       RecordTable>-----Tags-----<TagSelfJoin>-----Tags 2

                       RecordTable::TagName = Tags::TagName

                       Tags::TagName = TagSelfJoin::TagOwner
                       Tags 2::TagName = TagSelfJoin::TagMember

                       Tags and Tags 2 would be Tutorial: What are Table Occurrences? with the same data source table.

                       That maps out the tags and relationships in a hierarchical structure, but I am still mulling over how best to implement selecting a tag and seeing all records in RecordTable that Link to that same tag or one of the tags for which it is a "member".


                  • 6. Re: Hierarchical tags

                         Thanks very much; I'll play with it a little and see if I can get what you kindly suggest to work.

                         Your help - as usual - much appreciated!

                    • 7. Re: Hierarchical tags

                           This one intrigued me enough to set up a demo file.

                           It took a bit of "cogitating" to come up with a script that successfully parsed a return separated tag list that could then be used to pull up all related records that specify one of the tags on the list.


                           This one is a bit wild with a lot of less than obvious tricks used so feel free to ask questions about any part of the system that doesn't make sense to you.

                      • 8. Re: Hierarchical tags

                             Thanks again, PhilModJunk - it is intriguing, isn't it :-)

                             I'm going to be able to work onthis again on Monday. May I get back to you here with any questions I may have after I've taken a closer look, plase?