Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

I have a script of sorts, where I can add "tags" to a record, for ease of searching.

The difficulty I am having is when it comes to deleting those tags. Here is my delete script:

Set Variable [$TAG; Value:CaseLaw::CaseLaw_ShowTag]
Freeze Window
Go to Layout ["Tags" (Tags)]
Enter Find Mode []
Set Field [Tags::Tags_Tag; $TAG]
Perform Find []
Delete Record/Request [No dialog]
Enter Browse Mode []
Go to Layout ["CaseLaw" (CaseLaw)]
Set Field [CaseLaw::CaseLaw_ShowTag; ""]
Go to Field [CaseLaw::CaseLaw_ShowTag]
Refresh Window 

The problem is, lets say I have a tag that is:

"criminal negligence" and then another that is simply "criminal".

Let's say I want to delete the criminal tag. So I select the "criminal" tag and then run the delete script. It will INSTEAD delete the "criminal negligence" tag.

What am I doing wrong that it does this?

I also have a similar difficulty when I am adding the tag, in that I have it check for duplications. If I try adding "criminal negligence" first then adding a "criminal" tag second, it will say it's already been added. My script is below:

Set Variable [$TAG; Value:CaseLaw::CaseLaw_ShowTag]
Freeze Window
Go to Layout ["Tags" (Tags)]
Enter Find Mode []
Set Field [Tags::Tags_Tag; $TAG]
Perform Find []
If [Get (FoundCount) ≠0]
Show Custom Dialog ["NOTICE";"this has been entered before, etc"]
Else
New Record/Request
Set Field [Tags::Tags_Tag; $TAG]
End If

It is driving me rather mad, I simply can't figure out what I have done wrong.

After the find, you basically delete the very first record found.  You probably should explicitly check if that record is indeed the tag that you want.

 

 

Also, change this:

Set Field [Tags::Tags_Tag; $TAG]

to

Set Field [Tags::Tags_Tag; "==" & $TAG]

 

using "==" forces filemaker to search for EXACT matches.

The regular find in FM does a CONTAINS search.

 

So searching for "criminal" will find

- criminal

- criminal investigations

- criminalabcdefgh

I also have a similar difficulty when I am adding the tag, in that I have it check for duplications

 

Same problem as in your first script, which Wim has already explained.

 

But you can check for existing values without even leaving the layout:

Set Variable [ $TAG; Value:CaseLaw::CaseLaw_ShowTag ]
#
If [ not IsEmpty ( FilterValues ( $TAG ; List ( Tags::Tags_Tag ) ) ) ]
  Show Custom Dialog ["NOTICE";"this has been entered before, etc"]
  Exit Script
End If
#
Go to Layout ["Tags" (Tags) ]
New Record/Request
Set Field [Tags::Tags_Tag; $TAG]

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.