1 2 Previous Next 23 Replies Latest reply on Feb 25, 2017 6:09 PM by bHouston

    Create Individual Keyword Tag Buttons

    bHouston

      Hello! I have an image database I use to keyword/tag images. Keywords can be manually typed into a Keywords field (comma space separated) and I also have a global ApplyKeyword field in which the user can type in a keyword and by clicking the image button, apply that keyword to the Keywords field. The current ApplyKeyword field was created as a global field for batch application to images in a portal on another layout but the global storage may not be needed here:

       

      What I would like to be able to do for my users is to generate individual keyword tag buttons, so that when a user enters a keyword into a specified ApplyKeyword field (again, not sure if this should be global or not) and either tabs out or hits the Enter key (OnObjectExit), that keyword automatically gets applied to the image record, populating the comma space separated Keywords field (I already know how to do this and have it implemented),

       

      AND THEN (this is where I'm stuck!)... each applied keyword becomes its own individual "tag" button that appears on the record.

       

      Essentially, rather than manually typing/viewing/editing keywords into a text field, I would love to see and use keyword buttons (like commonly used button tags - in fact, just like the Tags used on this forum when submitting a new discussion, where once applied, you can click the X to remove)) to visually represent which keywords are applied to an image. So each record would have a set of individual keyword buttons (ideally alphabetized) that can be clicked to remove that particular keyword or when a new keyword entered into the ApplyKeyword field, generate a new keyword tag button. I know how to create the buttons on an existing field and get them to do what I need them to (as far as adding or removing the keyword) but where I'm stuck is how to generate these individual keyword tags.

       

      I do have a Keywords Table, in which each keyword is its own record. But I can't figure out how to link the Images table and Keywords table in a way that will produce the above desired function (if a portal is needed to achieve such) and there would constantly need to be new Keyword records created by all users. I just can't grasp how that relationship would even produce such, particularly given that new Keyword records will constantly be created (the user isn't limited to existing Keywords). Alternatively, I'm wondering- is there a way that the comma space separated text keywords in the Keywords field could generate these tags for each record?

       

      Thanks in advance for your time and help! This has been plaguing me!!

        • 1. Re: Create Individual Keyword Tag Buttons
          NicoChiaro

          I have done exactly what you seek. I even have favorite tags for every user and dynamic filtering and related tags.

           

          related tags can be described like this: It you want pictures to have the tag "picture" not f.e. "image", then give the tag "picture" the related tag "image" and every word that it could be mistaken for. on every search they will just be able to tag the "picture" tag. This is a kind of standardization feature which is very nice.

           

          Don't take a Comma Separated Field take a Cross Table this is much better in this case. You should have a portal where you can show the tags (those are the buttons you seek). These buttons get a script which will write the ID's of your tag and your record in the cross table and navigate back to the original layout. (Fix the window to avoid the flickering).

           

          In the Tags table you can the calculate the use count of each tag and sort the portal by this number. Like this you get the mostly used tags on top.

          1 of 1 people found this helpful
          • 2. Re: Create Individual Keyword Tag Buttons
            bHouston

            Thank you so much for the response, NicoChiaro

             

            Okay, I love what you are saying here about dynamic filtering and related tags (this could be SO useful for me, as I will want a way to standardize synonymous keywords - i.e, I always want 'sofa' as a keyword and not 'couch' or 'davenport'). And if I could calculate the use count of each tag for a given projectD and display that for the user as well, they could easily use those tags to apply keywords to the current record without typing in a project common keyword for each record/image.

             

            So, we are definitely on the same page and I was very excited to read about the above. However, I am still trying to wrap my head around how to do this, specifically your third paragraph re: cross table. Okay, so If I understand correctly, there will be need for a repetitive field (these being the 'tags' from the Tag table I can make into buttons?) contained within a portal within my Image record table? I will need the corresponding Tag Table (I assume this is where the cross table "lives"?), which the script you mention will reference to create new keyword tags (if not existing match) and create the visual tag back on the Image record?

             

            I think I am grasping this, conceptually. However, I've not created a cross-table or repetitive field before, so any additional guidance you are willing to share would be greatly appreciated! Thanks again!

            • 3. Re: Create Individual Keyword Tag Buttons
              erolst

              'Cross-table' would be a join table - and no, you don't need repeating fields; that's why you create a related table 'between' your existing tables, like

               

              Image --< ImageTag >-- Tag

               

              which means: an image can have many tags, and a tag can be associated with many images.

              To that end, each record in the join table ImageTag has (in addition to its own primary key) two 'foreign keys': one for an Image record, one for a Tag record.

               

              Easiest way to tag an image (ie create a new join table record with the keys of the current image and a selected tag) is to create a 'Cartesian' relationship between the Image table and a new table occurrence of the Tag table.

               

              You could then display a list of all existing tags in a portal for scripted selection/deselection, and also allow for the convenient addition of new tags. Use conditional formatting to highlight already added tags (or filter the portal to only show non-associated tags for the image).

               

              Endless possibilities ...

              1 of 1 people found this helpful
              • 4. Re: Create Individual Keyword Tag Buttons
                NicoChiaro

                Can you give me specifications about your solution, your filemaker version, hosting or local, operation system etc?

                 

                Let's make this up step by step. You'll need an idea of the data structure first: relationships, fields you need, tables, crosstables and calculated fields and their relationship to other fields.

                 

                Are you beginner with filemaker or have you been working with it and developing something so far?

                • 5. Re: Create Individual Keyword Tag Buttons
                  NicoChiaro

                  join table- natürlich

                  • 6. Re: Create Individual Keyword Tag Buttons
                    erolst

                    Im Deutschen als "Kreuztabelle" bekannt - wobei sich dort natürlich hier mehr als zwei Tabellen treffen (kreuzen) können …

                    • 7. Re: Create Individual Keyword Tag Buttons
                      bHouston

                      Thank you for clarifying the join table, erolst! I've not had to use this yet in my database and this discussion is so illuminating, as I can see indeed that there are many exciting possibilities utilizing such! I did a little reading up on it and it makes perfect sense structurally!

                       

                      Thank you so much for your willingness to help walk me through this, NicoChiaro! I am using FMP Advanced 15, right now it is local but will become hosted, accessed by under 10 users. I am operating with OS X 10.11.6 but my users will certainly vary. 

                       

                      With the guidance from erolst above, I was able to create the following tables and relationships:

                       

                      Images -- <ImagesTags> -- Tags

                       

                      Each table has a primary key: ImagesPrimaryKey, ImagesTagsPrimaryKey, TagsPrimaryKey

                       

                      I have set up the primary and foreign keys, as guided by erolst. So, all set there.

                       

                      The Tags table was created solely to perform this desire tagging function, so only contains the following fields:

                      - TagsPrimaryKey

                      - TagsID (this will be the keyword tag)

                       

                      My Images table has a lot of various fields for data work. However, the fields specifically pertaining to this desired tagging operation:

                      - ImagesPrimaryKey

                      - AllKeywords (a text field containing all keywords/keyword tags applied to the image record, comma space separated)

                      - ApplyKeyword (text field I would like the user to be able to enter a keyword tag into, hit enter or tab out of the field and have that keyword applied to the image record, populating both the AllKeywords text field and the tag button functionality I'm trying to achieve) - not sure if this needs to be a global field or if other specifications required to make this work as desired.

                       

                      Once the tag button has been applied to the image record, I would like the user to be able to click on the keyword tag button to remove that keyword tag from the image (hence, also removing from AllKeywords field).

                       

                      This is what I'm hoping to achieve in simplest form. Yes, thanks to the great ideas you both shared above, I would love to go further with related tags (ensuring one form of a keyword is used even when identified variations are input by the user - again, i.e, replacing 'sofa' anytime a user enters 'couch' or another specified variation), implementing spellcheck functionality and more! Indeed, so many great possibilities!

                       

                      Thank you SO much for your time and assistance with this. I love learning, expanding my knowledge of FileMaker! Grateful for your help!

                      • 8. Re: Create Individual Keyword Tag Buttons
                        bHouston

                        Where I got stuck with your solution erolst is the Cartesian relationship. I set up the join table and primary and foreign keys, established those relationships. But what tables and keys am I joining in the Cartesian relationship? Is another table occurrence needed? I understand how to manually create the relationship (X instead of = when defining a relationship) but not what fields/keys to use to form the relationship and show the proper data (the keyword tags applied to the image). And I'm not sure how to reference the AllKeywords field (which is where all keyword tags will be stored, comma space separated).

                         

                        Thanks so much for your help!

                        • 9. Re: Create Individual Keyword Tag Buttons
                          erolst

                          bHouston wrote:

                          Where I got stuck with your solution erolst is the Cartesian relationship. I set up the join table and primary and foreign keys, established those relationships. But what tables and keys am I joining in the Cartesian relationship? Is another table occurrence needed?

                          Create a new TO of Tag (and give it a meaningful name) and join it to Image by any two fields. In the portal, you can show the tag name; a script that will add the keyword can access any data (eg the primary key) from the record that is represented by the portal row, without it (the data) having to be present there (in the portal row).

                           

                          Also, I just read your other post. Note that you should not have an Allkeyword(s) field. The related records in the join table are the assigned keywords for the image. Adding a tag means creating a new related record; to remove a tag assignment, you delete the related record that represents that assignment.

                           

                          btw, what's your FM version?

                          1 of 1 people found this helpful
                          • 10. Re: Create Individual Keyword Tag Buttons
                            beverly

                            Any two fields can be linked in the Cartesian. I prefer they be the same type.

                             

                            Sent from miPhone

                            • 11. Re: Create Individual Keyword Tag Buttons
                              bHouston

                              Thanks, erolst! Okay, so the Cartesian relationship exists between Images and a TO of Tags, related by any two fields. The portal in the Images field I will be inserting is the related Tags TO?

                               

                              While it sounds like I will not need the AllKeywords field for this desired keyword tag button functionality, I will require the keywords to be populated into a comma-space separated field for a couple of reasons: 1) we tweak this initial set of keyword tags for various customizations (so we end up with various sets of keywords for one image - not addressed in this tag button layout or step in the process), and 2) keyword data is finalized in comma space separated format. So, while this AllKeywords field is not needed for this desired tag button functionality, it is still okay to keep it for my/admin use (not visible to the user), right?

                               

                              Using FM15.

                               

                              Many thanks!!

                              • 12. Re: Create Individual Keyword Tag Buttons
                                bHouston

                                Thanks, beverly! By same type, do you mean field type?

                                • 13. Re: Create Individual Keyword Tag Buttons
                                  beverly

                                  Yes. My preference.

                                   

                                  Sent from miPhone

                                  • 14. Re: Create Individual Keyword Tag Buttons
                                    erolst

                                    bHouston wrote:

                                     

                                    While it sounds like I will not need the AllKeywords field for this desired keyword tag button functionality, I will require the keywords to be populated into a comma-space separated field for a couple of reasons: 1) we tweak this initial set of keyword tags for various customizations (so we end up with various sets of keywords for one image - not addressed in this tag button layout or step in the process), and 2) keyword data is finalized in comma space separated format.

                                    Two things to consider:

                                     

                                    1) Generate the contents of that field as a by-product; i.e. manage your keywords via the relational structure, and make the AllKeyword field a calc field (text) as

                                     

                                    Substitute ( List ( Tag::name ) ; Char(13) ; ", " )

                                     

                                    This will automatically have the correct contents.

                                     

                                    2) Having said that: you could elect to not create that field and generate the comma-delimited list on demand within a script. Really depends on your workflow(s). (In FM 14 and 15, there is a number of ways to implement layout calculation objects - ie generate calculated content without a field or script.)

                                     

                                    To answer your other question: the basic structure is

                                     

                                    Tag_Cartesian x Image --< ImageTag >-- Tag

                                     

                                    Image is your layout context, where a portal into Tag_Cartesian serves as selector, and a portal into ImageTag (with the name field from Image) is the display of assigned tags.

                                     

                                    (This UI model can of course be tweaked and tuned and deconstructed in numerous ways; the important thing is the underlying relational structure.)

                                    1 of 1 people found this helpful
                                    1 2 Previous Next