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

Script keeps filling in the same portal row

Featured Replies

  • Newbies

This problem is related to a script, portal and value list, so I hope I'm posting to the correct forum.

I have a layout where I'm using a pop-up menu (field name: StandardInfoRelatedPages) to populate three fields in a portal. The pop-up menu is populated by a value list. The value list is kind of complicated because each "value" actually contains three bits of information, which are a title/headline, URL and description (for example: My Site^http://www.mysite.com^Generic description). These bits are separated by a "^" character.

Once a value is selected in the list, you may click a button that triggers a script that parses the value list and fills in the title/headline, URL and description portal fields (from the database named RelatedPages) with the appropriate information.

This process works correctly the first time it is performed. However, if I try to add another value from the value list, the new value replaces the first value instead of filling in the second row of the portal. I have tried setting the Go to Portal Row script step to "Next" at the end of the script, but it doesn't appear to be making any difference.

I have included the text of the script below to make the problem clearer. Is there anything I'm missing? Any help would be greatly appreciated.

Set Field [ RelatedPages::Title, Left(StandardInfoRelatedPages, (Position(StandardInfoRelatedPages, "^", 1, 1) - 1)) ]

Set Field [ RelatedPages::Link, Middle(StandardInfoRelatedPages, Position(StandardInfoRelatedPages, "^", 1, 1) + 1,

Position(StandardInfoRelatedPages, "^", 1, 2) - Position(StandardInfoRelatedPages, "^", 1, 1) - 1) ]

Set Field [ RelatedPages::Description, Right(StandardInfoRelatedPages, Length(StandardInfoRelatedPages) -

Position(StandardInfoRelatedPages, "^", Length(StandardInfoRelatedPages), -1)) ]

Set Field [ StandardInfoRelatedPages, "" ]

Go to Portal Row [ Next ]

You can always have a global field that captures the next portal row value and set it to that in your script (last +1). The portal row [next] function works with the last active portal the user has clicked on when the script is run.

Hi,

You'd better move to a multi predicate relationship, specially designed for this record creation, and set to allow creation of related records.

You don't need any portal for this, just the one you have right now to check data was entered, that should have the primary_key matching the foreign_key.

The relation between your Current Table and the new ocurrence of the RelatedTable (call it Related_Create) would be :

gTitle = Title

gLink = Link

gDescription = Description

gUniversal_key = yourSerial Number.

So that you script now becomes.

SetField[gTitle; YourTitleParsingCalc]

SetField[gLink; YourLinkParsingCalc]

SetField[gDescription; YourDescriptionParsingCalc]

SetField[gUniversal_key; GetAsNumber("")]

SetField[RelatedCreate::foreign_key;CurrentTable::primary_key]

SetField[gTitle; ""]

SetField[gLink; ""]

SetField[gDescription; ""]

SetField[gUniversal_key; GetAsNumber("")]

CommitRecordRequest

HTH

  • Author
  • Newbies

Thanks to both of you for your help. However, I found a solution from a different source. Here's the new script:

Go to Field [ RelatedPages::Title ]

Go to Portal Row [ Last ]

Set Field [ RelatedPages::Title, Left(gStandardDescription, (Position(gStandardDescription, "^", 1, 1) - 1)) ]

Set Field [ RelatedPages::Link, Middle(gStandardDescription, Position(gStandardDescription, "^", 1, 1) + 1,

Position(gStandardDescription, "^", 1, 2) - Position(gStandardDescription, "^", 1, 1) - 1) ]

Set Field [ RelatedPages::Description, Right(gStandardDescription, Length(gStandardDescription) -

Position(gStandardDescription, "^", Length(gStandardDescription), -1)) ]

Set Field [ gStandardDescription, "" ]

Exit Record/Request

Refresh Window

I think this works because the Go To Portal Row step is at the top of the script and the Refresh Window script is at the bottom. However, if anyone can offer a more concrete and thorough explanation, I'd certainly enjoy reading it. [color:"blue"]

Your portal is then set to "allow creation of related records".

When targetting the last row, you'd actually be automatically filling a new record from the portal relationship.

If it weren't (set to "allow creation of related records" ) you'd be filling the last valid record and your post title wouldn't change this much as you'd always be setting the same row, that is to say replacing data into the last one.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.