Revisited: Hashtags In FileMaker

It’s been 3 years since our post “Hashtags in FileMaker”, so we decided to give the demo a bit of a refresh and add a few features. To review, the hashtag demo utilizes a web viewer to display the user-defined “hashtags”, which then call back to FileMaker to either add, delete, or perform a find for the hashtag. Since its inception in FileMaker 14, the web viewer object hasn’t had any notable features added to it, but between FM 14 and FM 17, the web viewer seems to have become more integrated into a layout. Specifically, you no longer need to click into a web viewer in order to make it “active”, which makes for a much more seamless user interface.

I’ve made a number of small enhancements to this demo file, listed below:

  • Added a global container to store the “delete” image icon used to create the delete button for each hashtag

  • Added Find-mode functionality to search by hashtag

  • Added options to auto-complete and select hashtags from a drop-down in both Browse and Find modes

  • Removed the option to use the hash character while typing the hashtag, similar to Twitter’s interface

  • Fixed a bug when deleting hashtags

  • Updated interface

Since the web viewer is separated from fields in the database, we can’t exactly reproduce Twitter’s interface for adding and deleting hashtags inline with other text. We could grab the text entered into the web viewer with each keystroke, then perform the actions based on the keystroke code, but it’s still not quite as seamless as we’d like, so for this example, we’re separating the hashtags into their own field, then defining the specific addition/deletion/find call-back actions in the html.

For creating the refactored delete button, we’re storing the delete image in a global container field, then using FileMaker’s Base64 functions to take the image in the container, then encode it to be used as a string in the HTML. Utilizing Base64Encode allows the developer to drop in any image for the deletion button, and reuse it multiple times throughout the web viewer, all without adding much complexity.

<a href=\"fmp://$/" & Get ( FileName ) & "?script=DeleteTag&param=" & $tag & "\">" & "<img src='data:image/png;base64," & Base64Encode ( Contacts::DeleteContainer ) & "' style=vertical-align:middle />" & "</a>

In the original post, there was a note about the fmp protocol limitation in the operating system. Since then, I have discovered the RCDefaultApp which allows MacOS users to easily set the default application used for various URL schemes, file extensions, file types, MIME types, and Uniform Type Identifiers. In this case, I use RCDefaultApp to select which version of FileMaker to open when the fmp protocol is called. When I’m working in FM17, I’ll set the fmp URL to open in FileMaker 17. It’s a free download, and a must-have for any developer working with multiple versions of FileMaker.

The demo file included with this post is free for the taking (post email-submission), so feel free to download the file and use it to your liking. As always, if you have any questions or would like assistance customizing the Hashtag Demo for your solution, please contact us.

9 thoughts on “Revisited: Hashtags In FileMaker”

  1. Hello again after all this time.

    I encounter a strange bug, that was there since the begining but didn’t wrote a message about it till now.

    If you take your example, and erase all data, keeping the model as it is, it’s not possible to delete the added hashtags that have a space in their name or a dash (and probably some other chars). Clicking on the cross icon have no effect at all.

    There should be a reason but I can’t point it out..

    Could you try and help me defining where that bug is coming from?

    Thanks anyway;

    Thierry

    1. Finally, it does not have any relation with the data that have been erased. I tried to deal with this problem and the only way I found to remove these problematic hashtags was to create an extra hashtag, then it’s possible to remove the hashtag that was having a dash or a space in its name. Which is not possible otherwise. It’s really weird that when a hashtag is created with a dash / space in its name, it creates an extra empty hashtag. Any suggestion could be appreciated 🙂

      1. I made a couple of tweaks after observing it in use.

        My users were entering multiple words as a tag, which was causing extra “empty” hashtags to show up in the web viewer. I changed line 8 of the script “trig_Refresh Web Viewer Tags” to use ValueCount instead of WordCount.

        The contents of the global container field didn’t show up for users in our hosted file. I changed the HTML in line 17 of the same script to remove the img tag referencing the container field and replaced it with the HTML entity for the Unicode glyph “erase to the left” (U+232B), which seems to be working (I’ll have to check in with the users to confirm).

        Thanks again!

  2. Hello !

    Do you think it’s possible to link this hashtag system to a specific hashtags table, including the joint table to link the hashtag(s) to my main entity (contact / book / whatever) ?

    I suppose I just have to change the hashtags field location and as an extra step, filling up the joint table in the code.

    Thanks in advance

    1. Absolutely! The hashtag words can be stored in any location, as long as the relationship is maintained in the script context. You’ll have to decide how the tables will need to be related depending on the solution, but once you have the relationship in place, the scripts in the “Tag Words” script folder will need to be updated to use the new table occurrence.

      Thanks and feel free to reach out with any other questions!

      1. Thanks. It should need some brainstorming to adapt the script to use relations tables but I feel it’s totally possible too.

        I have another question indeed. I imported in my project the tag system but I’m still facing the “Your access privileges do not allow you to perform this action” error when I’m trying to delete a tag. It’s working well on demo app.

        I’m trying to search currently how to resolve this.

        Thanks again in advance.

        1. Finally I resolved this permission problem by going to advanced security permission -> Full Access -> * Run Filemaker Scripts.

Leave a Reply

Your email address will not be published. Required fields are marked *