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.

Modify delete portal row script to evaluate field value with context

Featured Replies

I want to modify a delete portal row script. When the enduser clicks on the delete portal row button... I want to evaluate the value of Field1 the selected portal row. If the value in Field1 = the value on the context page called Field2... clear Field2, and delete the portal row, otherwise, just delete the portal row.

now, after the appropriate portal row has been deleted, if the result is that Field2 value IsEmpty perform another script that prompts the enduser to assign a new value, but allow them to cancel if they wish.

What is "the context page"?

A less abstract description will help us understand what you're trying to accomplish (and why!) thus provide better-suited suggestions.

  • Author

The context is People and the portal is Households2People. Every person entity can have one Last Primary Household and/or one Last Additional Household. The Households2People portal contains the history of households as people move over the course of their lifetime. Some people move from one primary household to another. Others may have both a primary household and an additional household they are associated with. Every time a new record is applied to the portal a field automatically populates to identify it as either a Primary or Additional household and then script overwrites the values in the lastPrimaryHHD or lastAdditionalHHD fields in the People table with this most recent value.

I look to the lastPrimaryHHD field and the lastAdditionalHHD field from the People table when determining their current values. But I run into a problem when someone deletes a portal row in the Households2People table because the People table may still contain the lastPrimaryHHD or lastAdditionalHHD value which is now being deleted from the Households2People table.

Obviously, there must be a better way to do this... any suggestions would be monumentally appreciated. :shocked:

Couldn't the two fields in the People table - lastPrimaryHHD and lastAdditionalHHD - be calculated? Or perhaps you could use filtered portals to show the two last households, without bothering with their IDs.

  • Author

Either of those suggestions would really simplify how I was initially approaching this. Thank you for the ideas. :laugh2:

  • Author

Can you help me with the calculation? I want to return the highest value based on multiple criteria...

I want the [iD_HDD_fk] with the most recent [startDate] only if the [endDate] IsEmpty and the value of the [type] field = "primary". What would such a calculation look like?

If the display only idea is satisfactory, I'd suggest you go that way. Create a new portal to the households table, make it one row high and filter it to show only records where Type = "primary" and Is Empty ( EndDate ). IIUC, only one record should meet both criteria.

For the other type, sort the portal by StartDate, descending.

  • Author

What about for data retreival? If I want to identify the most recent primary household in all my records. If I refer to the new portal it will still produce multiple records even though the view shows only one. Is there a calculation I do can do get that the most recent "primary" and Is Emtpy [endDate]?

Every person entity can have one Last Primary Household and/or one Last Additional Household.

If I refer to the new portal it will still produce multiple records even though the view shows only one.

These two contradict each other.

I believe they mean that they need to refer to the value outside the portal and that, although the filter produces only one record, the portal (relationship) produces more than one.

Possibly, but that would contradict the answer to my question in post #4. The thing is that filtering is simple, the calculation is not.

Create an account or sign in to comment

Important Information

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

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.