Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 3783 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi All,

I am getting a weird record creation error on occasion and I am struggling to find the source of the error. I have an Installation creation script that is straight forward but on occasion the record is being created but the Key Field data (Contract_No) is not being entered and therefore the related record lookup data fails.

In the background of this on the system that is acting as the server a backup script is acting on an On Timer trigger. As the creation script is fairly simple I am wondering if the On Timer script may somehow be interfering with the creation script.

 

 

 

Create_Installation

# #CHECKS THAT A CONTRACT VALUE HAS BEEN ENTERED, IF NOT EXITS THE SCRIPT #

If [ IsEmpty ( Contracts::Rental ) ]

Show Custom Dialog [ Title: "Insert_Rental_Value"; Message: "THE RENTAL TERM AND VALUE MUST BE ENTERED BEFORE CREATING AN INSTALLATION"; Buttons: “OK”, “Cancel” ]

Exit Script [ ] End If

#

#MAKES SURE THAT THE USER ACTUALLY WANTS TO CREATE A NEW CONTRACT RATHER THAN JUST VIEWING IT

#

Show Custom Dialog [ Title: "Create_Installation"; Message: "DO YOU WANT TO CREATE A NEW INSTALLATION RECORD OR JUST VIEW THE INSTALLATION"; Buttons: “CREATE”, “VIEW” ]

If [ Get ( LastMessageChoice )=2 ] Show Custom Dialog [ Title: "USE_VIEW_BUTTON"; Message: "PLEASE USE THE "VIEW INSTALLATIONS BUTTON"";

Buttons: “OK”, “Cancel” ] Exit Script [ ]

End If

#

#CHECKS THAT AN INSTALLATION HAS NOT ALLREADY BEEN CREATED FOR THE PARTICULAR CONTRACT

#

Copy [ Contracts::Contract_No ] [ Select ]

Set Error Capture [ On ]

Go to Layout [ “Installation” (Installation) ]

Enter Find Mode [ ]

Paste [ Installation::Contract_No ] [ Select ]

Perform Find [ ] If [ Get ( LastError )=0 ]

Show Custom Dialog [ Title: "Installation Exists"; Message: "AN INSTALLATION FOR THIS CONTRACT NUMBER ALLREADY EXISTS"; Buttons: “OK”, “Cancel” ]

Exit Script [ ] End If

#

#CREATE NEW INSTALLATION RECORD

#

New Record/Request

Paste [ Installation::Contract_No ] [ Select ]

Set Error Capture [ Off ]

 

This is on FMP 11

Posted

More likely the copy and paste technique is the culprit.

The copy paste buffer can get corrupted so try using a $var to capture the entry and use Set Field to complete the find and record creation.

OnTimer is also not valid as a server side step.

Posted

Hi, thanks for the response. Yes I will change the script to use a $var, I had considered that, and see if that effects anything. The database is being served from a workstation, i.e. launched and shared as there are only four users, with a launcher file being used to log in to the shared file, does that make a difference ?

Posted

So, not a true server environment, that does change matters.

FM server actually pauses dB's during copying but FM pro cannot.

Realistically using FM pro as host you cannot deliver full server facilities.

You need to control the backups to sensible points in time, or move up to server.

Posted

OK thank you, I will try that as the frequency of errors is, I think, to great to be buffer errors as it is occurring in about 20% of Installation creations. though strangely only in Installation creations not in any other table.

Posted

It looks as though you have Set Error Capture [on] in your script, so if you were to test the value of get(lastError) immediately after the New Record step, you would know if the new record step worked or not.

 

Why do you need to do the search in Installations to determine if there is a relevant record for the contract? If the Contracts and Installation tables are related using Contract_No, then a test for count(Installation::Contract_No) > 0 from the Contracts layout would tell you if there is already a related installation record. 

 

If you allowed creation of records via this relationship, then you would be able to add a new installation record by simply writing a value into one of the installation record fields from the context of the Contracts layout, e.g. set field[installation::_timestamp; get (currentTimestamp)]  You can do your get(lastError) test immediately after this step to check if the new record was successfully created.

 

Brian

This topic is 3783 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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