September 9, 20196 yr 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.
September 9, 20196 yr Here's a few videos that may help: https://www.youtube.com/results?search_query=FILEMAKER+DUPE+CHECK
September 10, 20196 yr Author 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
September 10, 20196 yr 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, 20196 yr by comment
September 10, 20196 yr 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.
October 6, 20196 yr Author 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.
Create an account or sign in to comment