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

Modify delete portal row script to evaluate field value with context


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

Recommended Posts

Posted

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.

Posted

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.

Posted

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:

Posted

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.

Posted

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?

Posted

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.

Posted

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]?

Posted

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.

Posted

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.

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