Q:

Creating Keyword/Tag System in FileMaker 14

I have a FileMaker 14 database of events. I want to be able to tag each event with keywords. Therefore, I have created a three tables, structured as such:
Events ---< Tags >--- Keywords
Now, in order to add keywords as tags to an event, I want to make sure the keyword has not already been added and that it exists in the tables of keywords. If it doesn't exist, it should be created and then added as a tag. 
In order to implement this, I thought I could have a global field where the user enters the keyword they want. Then a script would do the following:
Enter keyword in global field
Set variable $eventID wtih ID of current event
Set variable $keyword with value from global field

Check if $keyword is present in Keywords table

    if yes
        get id of $keyword and put in variable $keywordID
        check if $keywordID is already tagged to event

            if yes
                display message, "this keyword has already been added to this event"
            if no
                create new record in Tags table with $keywordID and $eventID
                clear global field
                exit script
    if no 
        create new record in Keywords table with $keyword value in keyword field
        set variable $keywordID with value of id field
        create new record in Tags table with $keywordID and $eventID
        clear global field
        exit script

This is the step-by-step script I am attempting to write. However, I am stuck at how to check if the $keyword is present in the Keywords table and then how to get the id of that $keyword from the Keywords table.
Please let me know if you have suggestions or if there is an easier way to tackle this issue.

A:

There are many ways you could handle this - for example, you could have a relationship linking the global field (in any table) to the Keyword field in the Keywords table. Then you would know instantly if a related record exists and what is its ID.
Alternatively, you could perform a find in the Keywords table. Or your script could attempt to create a new record and watch for an error caused by the validation of a keyword as unique failing.
BTW, is it possible for a keyword to require a global change? If not, why do you need a KeywordID? You could simply use the keyword itself, and validate it as unique. (Yes, I know you've been told it's bad practice. It is. Usually. When there is a reason.)

