rudym88 Posted September 9, 2019 Posted September 9, 2019 Good day Gurus, I am trying to check if a record exist during data entry and if it does display a "new windows" with a warning, to accomplish this i am using btih "Set Script Triggers" and error capture in the below script but don't seem to work. Field: kDocumentNumber - "Unique value" is checked Data Entry Window: Warning Message Windows Script i executing on exit using Trigger, here i am using The idea is if error "504" is capture show a new windows. if not exit script. What i am doing wrong or am i using the wrong approach to show a new windows based on an error. Any Help is greatly appreciated Thanks Rudy.
Steve Martino Posted September 9, 2019 Posted September 9, 2019 Here's a few videos that may help: https://www.youtube.com/results?search_query=FILEMAKER+DUPE+CHECK
rudym88 Posted September 10, 2019 Author Posted September 10, 2019 Thanks Steve, The link was shows some useful techniques, but was looking more for a way to do a custom message using cards. Thanks Rudy
comment Posted September 10, 2019 Posted September 10, 2019 (edited) Your script cannot work the way you want. The Get(LastError) function returns the error number for the most recently executed script step. In your script, the most recently executed script step is Set Error Capture[] - and this will never return an error, let alone error #504. In order to get a validation error, you must attempt to validate the field - and you must do this before the field is validated normally. Otherwise your window will open after the built-in validation error message, not instead (if at all). Try triggering the following script OnObjectValidate: Set Error Capture [ On ] # TRY TO EXIT THE FIELD Go to Next Field Set Variable [ $error; Value:Get ( LastError ) ] If [ $error ] Go to Previous Field Show Custom Dialog [ Message: "Your custom message can be here, or in a new window." ] # CANCEL TRIGGERRING EVENT Exit Script [ Result: False ] End If Note that the error number here will be 1, not 504 (I am not entirely sure why). Edited September 10, 2019 by comment 1
comment Posted September 10, 2019 Posted September 10, 2019 5 hours ago, comment said: Note that the error number here will be 1, not 504 (I am not entirely sure why). After some more experimenting: You will get error #504 if, instead of exiting the field, you try to commit the record. However, this has the side effect of committing the record in case the entered value is not a duplicate. You may not want to commit the record at this point.
rudym88 Posted October 6, 2019 Author Posted October 6, 2019 thanks, go tot to work like a charm. On 9/10/2019 at 11:47 AM, comment said: After some more experimenting: You will get error #504 if, instead of exiting the field, you try to commit the record. However, this has the side effect of committing the record in case the entered value is not a duplicate. You may not want to commit the record at this point.
Recommended Posts
This topic is 1875 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