Your Description of the problem is a bit confusing because the script itself does not interact with the portal object at all.
I switches to a layout, presumably one based on the portal's table and creates the new record there before returning. By "overrides it" what exactly do you mean? Do you see the quantity inserted into the wrong record? Or something else?
The script you show is patterned after one that is long used. It's main potential issues are a) It can trip a number of script triggers on a number of layout objects and b) it loses the focus on a particular portal row when the script returns to the original layout and the portal can even "snap" back to an unscrolled position, but it should create the correct new record in the portal's table if your portal is to an occurrence of inventory WG and Customer ID is the sole field used to link records in your portal's relationship to the customers table occurrence.
I'd check for script triggers that might perform a script that interferes with this process. Note that your "insert calculated result" is probably better replaced with set field, though there is a very small chance that it might be an issue here as it can also trip script triggers on the Inventory WG layout.
Hi! Thank you for getting back to me so quickly!
I wrote this script a few years ago, and it still works fine on Filemaker Go 13, but the same script doesn't go to the new record in Filemaker Go 15...it overides the previous one in the portal despite a new record correctly being created in the actual table.
Basically, it goes from the customer info layout..in which there is the inventory portal showing what products the customer has... to the actual Inventory WG table layout, creates a new record, inserts the Customer ID and Qty, then returns to the portal so the user can enter further details.
It works fine on my PC using Filemaker Advanced 15, and no errors show when I debug.
On Filemaker Go 15, instead of going to the new record in the portal, it puts the cursor into whatever is at the top and overrides it.
If I go out of the layout and back in again, the new record then shows in the portal.
So something is happening between going from the Inventory WG table, back to the portal but it is only on the latest version of Filemaker Go.
I tried removing the "insert Calculated Result" but it didn't help.
There are no script triggers set on either layout.
I have used variations of this script elsewhere in my database and the same thing is happening.
Its a mystery!
It is still not clear from your description what you mean by "overrides it". Please describe exactly what you mean by that phrase.
This is a very commonly used method for creating new records in a portal. I'd expect to see a lot of bug reports if it suddenly did not work.
So I did my own test. I found I had to create a new file for this as I have stopped using this method in my recent solutions as I prefer another approach.
When I use FM GO 15 on my iPhone, to test this scripted method. It works perfectly for me. I see a new record with "apple" in the "avalue" field appear in the portal each time I tap a button that performs this script.
seems that the script does not go to the 'lineitems-table', but 'goes' to the portal record via customer_id -> resulting in overwriting the first record
-> if there is no existing 'lineitems' record: Does it create a new one?
Why it works on desktop... no idea
If you read his script, it's nearly identical to mine. He is not actually "going to the portal row"--which is what I thought before I actually looked at his script and found the standard "Switch layout" method in his script.
That leaves the "override" term vague to me when I read his descriptions of the issue.
When reading postings from the in-box (at least on iOS, I only have the iPad here), then there is NO attachement visible on the start-posting )-:
I can see that by going to the 'real' posting, but not when reading via in-box
(You got to be pretty technical, these days -- Johnny Mnemonic)
Hopefully this might help as to what I mean about overriding
Here is an image of what should happen when the Add New Record script is run...this is in Filemaker Go 13 (and what also happens in Filemaker 15 Advanced on my PC.
And this is what happens in Filemaker Go 15...the cursor goes to the top record and there is no sign of the newly created record...however, the new record is created in the actual table and if I go out of this layout and back in again, the new blank record then shows in the portal.
Hope that makes sense!
What I can't work out is why it works on the older Filemaker Go version, and on the most recent desktop version...but not on the latest Filemaker Go!
Tried using this script with my variables in my database, and this is where it gets even stranger - it now works on Filemaker Go 13 and 15...but not on the desktop!
you've got some other stuff going on here. I don't think that this has anything specific to do with the script, but perhaps due to changes in FM GO as to what gets the focus as different events take place. My very simple test does not attempt to set the focus into a portal row or a field in the portal row and thus this would not be something that my first test checked on.
I've seen other reports that indicate that a behavior change in this area took place. What value list format did you specify for the brand field? Popup menu or popup list?
What layout object was named "WG Hangers"?