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

Strange behaviour of GotoPortalRow(Last)


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

Recommended Posts

  • Newbies
Posted

I imported an application from FM4 to FM10. Table A and table B connected with an Id. Layout of table A with a portal where table B records are shown.

Because I often enter portal records with several fields having the same data, I have a few variable fields on the layout and a pushbutton launching a script that does:

Go to Portal Record(Last) - this creates a new portal record

Set (portal) field x from variable x

Set (portal) field y from variable y

Go to Field(Z) - this is where I want to enter values.

In FM 4 this worked like charm. Clicking on the pushbutton always gave me a new portal record with default values filled and the cursor in the field where I wanted to enter a value. But not so in FM10. The weirdest things happen. FM10 overwrites the values in the first portal record. Or the second. Anywhere but the last "new" row. My last test: There were three portal records. Clicking on the pushbutton made Set Field update the default values in the second portal record and Go to Field put the cursor on the first portal record to wait for my input.

Now, if I first put the cursor in any field in the portal by clicking the mouse there, and then click the pushbutton, everything works fine. I have checked the relationships and everything several times and cannot find anything wrong. Simply what worked in FM4 doesn't work in FM10 although it should.

Am I missing something here, or....

Posted

As you have FM10 Advanced then enable the script debugger to monitor the movements through the script as the converted script is most likely the cause.

  • Newbies
Posted

I have done that too, but it doesn't show anything that could help. The script is so simple: GoToPortalRecord(Last), Set Field. Set Field, Go to Field(Amount)

Posted

The debugger will let you see the cursor movements. If the cursor did not go to the correct portal row and fields as expected then it should be obvious which script steps are not behaving as expected.

Don't forget to use the Data Viewer too.

Posted

I imported an application from FM4 to FM10. Table A and table B connected with an Id. Layout of table A with a portal where table B records are shown.

Because I often enter portal records with several fields having the same data, I have a few variable fields on the layout and a pushbutton launching a script that does:

Go to Portal Record(Last) - this creates a new portal record

Set (portal) field x from variable x

Set (portal) field y from variable y

Go to Field(Z) - this is where I want to enter values.

In FM 4 this worked like charm. Clicking on the pushbutton always gave me a new portal record with default values filled and the cursor in the field where I wanted to enter a value. But not so in FM10. The weirdest things happen. FM10 overwrites the values in the first portal record. Or the second. Anywhere but the last "new" row. My last test: There were three portal records. Clicking on the pushbutton made Set Field update the default values in the second portal record and Go to Field put the cursor on the first portal record to wait for my input.

Now, if I first put the cursor in any field in the portal by clicking the mouse there, and then click the pushbutton, everything works fine. I have checked the relationships and everything several times and cannot find anything wrong. Simply what worked in FM4 doesn't work in FM10 although it should.

Am I missing something here, or....

Go to portal row last does NOT create a new record.

You script is in somwhat reverse order, and should be:

Go to Field(portal::field)

Go to Portal Record(Last)

Set (portal) field x from variable x

Set (portal) field y from variable y

Commit record

Posted

Well, Bruce, I agree that Go To Portal Row [ Last ] doesn't create the record but it goes to the new portal row and the next Set Field[] certainly creates the new record. IMO, his script should be working as listed.

Posted

But Bruce has gotten me wondering ... Go To Field[] being first IS important if there is more than one portal on the layout. By going to the field first, it identifies which portal to work in. So three additional questions:

1) Is there another portal on that layout?

2) From layout mode, have you made sure that the fields within the portal all match the portal table occurrence?

3) You say you 'imported' from FM4 to FM10. Did you let FM convert it for you or did you import the fields and data and re-create the proper relationships?

  • Newbies
Posted

There is only one portal in the layout.

I have checked with the debugger and data viewer. The cursor doesn't go to the "new portal row" row. It changes values on the previous row and then goes to the *first* tow to wait for my input.

And yes, "Allow creation of portal records" is checked. Like I said, everything works fine if I first do "Go to Field(portal field)" in the script. But it gives an annoying flash, when the cursor first goes to the first row and then moves to the last.

  • 2 weeks later...
  • Newbies
Posted

I do this by scripting:

Goto Last Row

Goto Next Row

That's what creates the new record.

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