October 11, 201213 yr 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.
October 11, 201213 yr 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.
October 11, 201213 yr 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:
October 11, 201213 yr 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.
October 12, 201213 yr Author Either of those suggestions would really simplify how I was initially approaching this. Thank you for the ideas. :laugh2:
October 12, 201213 yr 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?
October 12, 201213 yr 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.
October 12, 201213 yr 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]?
October 12, 201213 yr 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.
October 12, 201213 yr 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.
October 12, 201213 yr 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