Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Strange behaviour of GotoPortalRow(Last)

Featured Replies

  • Newbies

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....

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.

  • Author
  • Newbies

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)

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.

Does it even create a new record? Have you made sure that you have 'Allow Creation of Related' to be on for the portal?

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

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.

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?

  • Author
  • Newbies

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.

Why don't you post a file showing the problem?

  • 2 weeks later...
  • Newbies

I do this by scripting:

Goto Last Row

Goto Next Row

That's what creates the new record.

No navigation step creates a new record - you must enter data into a field in the last row.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.