Thank you for your post.
I am unable to replicate the issue. This is what I have done:
1. In FileMaker Pro 14, I created a database file that contains two tables, linked by a number field "ID", with the option for the second table to allow creation of records.
2. I created the first script "Show Active Portal Row", with the script step:
Show Custom Dialog [ "Active Portal Row Number" ; Get (ActivePortalRowNumber) ]
3. I created a second script "Number of Portal Rows", with the script step:
Show Custom Dialog [ "Count of Portal" ; Count ( SecondTable::Phone )
4. I set the file for Network Sharing and configured for WebDirect.
5. Using the file locally, I created a new record, placed my cursor in the field in the portal, executed the script "Show Active Portal Row", and the result is 1. I executed the second script "Count of Portal", and the result is 0.
6. I then closed the file under FileMaker Pro 14, and opened the file under FileMaker Pro 15.0.2.
7. I repeated step #5 with the same results.
8. I uploaded the file to FileMaker Server 15.0.3 under Windows Server 2012 R2. (Windows Server 2008 R2 is unavailable at the moment).
9. I opened the hosted file on both a Mac (macOS Sierra 10.12.2) and Windows 7 computer using FileMaker Pro 15.0.2.
10. Repeating step #5, I get the same results.
Please let me know what I am doing differently than you so I can reproduce the issue.
Thanks for the reply and for your work on this. From my initial and somewhat cursory investigation your steps to reproduce are correct. I have done some further investigation myself and have created an example file following much the same path that you have and I can confirm that the issue does not reproduce.
From there I went on to try and work out what was different to my example file and our main file which produced the error. What I discovered is that the field that was launching the troublesome script (launched by an OnObjectKeystroke trigger) was also running an OnObjectModify trigger. I replicated this behaviour with a similar script in my example file and I was able to reproduce the issue.
I've uploaded the Example File I've made and you can download it here: Example File.fmp12 - Google Drive
I have tested this example file in FileMaker 14 and it works as expected, returning the correct portal row number. In FileMaker 15 it returns 0.
Let me know your results once you have had a chance to look at the example file.
The OnObjectModify script trigger is updating the field Modification Count which is in the current table and outside the portal. When that script trigger is removed, the Active Portal Row Number remains.
I don't know if this designed to fix another issue, but I have sent your file to our Development and Testing departments for an explanation.
In the mean time, there is a workaround.
First, create an OnObjectEnter script that initializes a variable. For example:
If [ IsEmpty ( RelatedField::Field 1 ) ]
Set Variable [ $$row ; Get ( ActivePortalRowNumber ) ]
Then, in your OnObjectKeystroke script, change the Show Custom Dialog to incorporate the $$row variable.
Show Custom Dialog [ "Get(ActivePortalRowNumber) Result" ;
"Get(ActivePortalRowNumber) = " & If (Get(ActivePortalRowNumber) > 0 ; Get (ActivePortalRowNumber) ; $$row) ]
Now, when you enter the empty field, the ActivePortalRowNumber is stored in the global variable $$row. When you press return before the related record is committed, it will display the ActivePortalRowNumber, unless it is 0, where it will then use the variable $$row.
Thanks for that. I've actually already implemented a workaround in our main file. Basically before executing the Get(ActivePortalRowNumber) function, the script moves focus to the next field which causes the record to be created. Once this is done, the Get(ActivePortalRowNumber) function returns the correct value.
Looking at the script actions in the script debugger, the OnObjectModify script trigger runs after the OnObjectKeystroke trigger, so logically I don't see any reason why that script trigger should interfere with the main script. That being said, removing that script step and adding in another step (just for testing sake) returns the behaviour to normal.
A bit of an obscure bug/issue. I will be interested to know what the development and testing team thinks about it.
Development and Testing are aware of this issue. Your information has been attached to the original report. When more information becomes available, I will post again.
Great, thanks for that. I'm glad we were able to narrow it down and that I'm not going crazy!
This portal record issue has been addressed in FileMaker Pro 15.0.3.
Thanks TSGal, I can confirm that this update resolves that issue.
Thanks for your help.