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

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

Recommended Posts

Posted (edited)

Hello all

I have a issue with related records not being created properly in FMP9, that worked fine in FMP6.

I use a portal to allow user to create line items in external file (File 'Sales' has a portal to 'Sales_Items' with permissions set to allow creation of records).

I have a button on each portal row to perform a script on that item, which starts by using the 'Go to Related Record' script step. Trouble is, that line sometimes doesn't exist properly in 'Sales_Items', so the go to related record fails with error 101 (record not found). This is odd, as the data is showing in the parent record. I can even do a search in 'Sales_Items' and find it, but when I then do 'Show All Records' it has gone again.

The files are being served on FMS9 on OS X.

Quitting FMP9 client and restarting results in the missing recrd apearing correctly.

I've never used the flush cache to disk script step, could this help? The bug is intermittant, and I can't repeat it to test things easily.

Edited by Guest
Posted

There is a difference in behavior with Go to Related Records[] when there are no matching records.

Can you post the script and describe the conditions when it fails?

Posted

Apologies for the long winded description but here goes.

I have a layout based on the single table in a file called 'Sales'. 'Sales' contains the header information for each sale, and a file called 'Sales_Items' contains the lines for the sales. The two are related by a unique ID 'ID' in 'Sales' and 'Sale ID' in 'Sales_Items'.

In this layout in 'Sales' I have a portal to 'Sales_Items' and the reationship allows records to be created in 'Sales_Items' when I start typing in a blank row in the portal.

Sometimes, when I start typing in the portal, the record is not being created properly in 'Sales_Items'. The error only happens perhaps 1 in 100 times, and I cannot understand what set of circumstances is causing it to happen. The 'Go to Related Record' script step cannot find the related record, and I get an error 101. If I stop the script after the error 101 using the debugger, I cannot see the auto-created record in 'Sales_Items' (it should be the last record). The last record still shows as the last line from the previous sale. However, if I do a search on the stock code in the 'Sales_Items' file, it des find the record. But if I then do a 'Show all records' its not there again. Its lke it hasn't been submitted to disk properly on the server or something.

Following is a script that is failing with error 101 after the Go to Related Records command. It is run from a button on each line of the portal.

This script never failed in FMP6 with FMS5.5 under OS X.

SI - Relationship to Sales Items

If [ (SI::bt = "Backorder") or (SI::bt = "LATER") ]

If [ not(Position(Sales::Full Name; "Cash Sale"; 1; 1) > 0) ]

Go to Related Record [ From table: “SI”; External; Using layout: ]

Commit Records/Requests

Perform Script [ “Go to Backorder Request” from file: “Sales Items” ]

Else

Show Custom Dialog [ Title: "Message"; Message: "Backorders cannot be placed for a Cash Sale. ¶Please enter or

choose full Customer Details and try again."; Buttons: “OK” ]

End If

End If

Does this help understand my situation at all?

Posted

Go to Related Record [ From table: “SI”; External; Using layout: ]

This is suspicious. It's a remnant of the conversion process. It could also just be the (well-known but annoying) visual display bug. But in either case, see if you can reassign this to the proper external layout.

These non-assigned external layout options like yours above often still work after conversion, but are not really reliable, in my opinion.

Posted (edited)

Sometimes, when I start typing in the portal, the record is not being created properly in 'Sales_Items'...

Perhaps you're not committing the new related record prior to attempting to jump to it. In FM7 and later, the related record doesn't actually exist until you've exited the field.

Edited by Guest
Posted

That presents a bit of a conundrum however. Because if you click a Go To Related Record button before you click out of the fields, then you can't Commit Record right then, or you lose focus of the row. What you could do is set the unique ID of the row (related record) into a global field, then Commit Record, then use the global in a relationship to Go To Related Record.

Then you could remove the Commit Record you've got after the Go To Related Record in your script; since commiting the parent commits the portal records also.

Posted

Thanks for your help, I discovered that the problem only happens if this is the first transaction after starting FMP9. If it is the second transaction it never happens. So I think it is definately a bug in FMP9 in conjunction with FMS9 (it never happens if the files are all local).

I have 'bodged' it by having a startup script that creates a new record and immediately deletes it in 'Sales_Items'. The scripts all work as intended then.

Once I successfully reproduced it I tested the Flush Cache function and it made no difference.

Thanks for all your help

Posted

"So I think it is definately a bug in FMP9 in conjunction with FMS9 (it never happens if the files are all local)."

I doubt it's a bug, others would have noticed something as significant as that already. There's probably something else going on. (It's more likely to be file corruption, but I'm not wishing that on you.)

This topic is 6259 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.