jamesrockford Posted December 6, 2014 Posted December 6, 2014 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.
Wim Decorte Posted December 6, 2014 Posted December 6, 2014 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
eos Posted December 6, 2014 Posted December 6, 2014 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]
Recommended Posts
This topic is 4030 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now