AnsweredAssumed Answered

Update/refresh Portal based on ValueListItems-calculation

Question asked by PeteTheFreeze on Nov 13, 2012
Latest reply on Nov 13, 2012 by philmodjunk


Update/refresh Portal based on ValueListItems-calculation


     Hi All,

     I got a problem with a portal not "refreshing" or "updating" after I change something in a relationship.

     The case: I created an unstored text-calculation field in my MainTable using only the ValueListItems(Get(FileName);"TheList") function. It shows ID's from a related table.

     The field itself works perfectly. Whenever I change a value in my MainTable upon which the TheList is based, I can see that the field containing the ValueListItems-function changes to a list of the right ID's drawn from the relation.

     Now I created a relationship between the ValueListItems-field and the ID-field of an occurence of another table. I made a portal showing all the related records from this new table occurence. The portal shows the right records when I use the GoToRelatedRecord script step from another table (MetaMainTable) to a related record in the MainTable. The calculation field changes to the right List of ID's and the portals shows the records with these ID's.

     However, when I stay in a record in my MainTable and then change the field that is used for the ralationship upon which TheList used in ValueListItems() is based, I only see the calculation field change. The portals shows me the former selection.

     So 1) I made a mistake in my assumption about any of these matters, or 2) I need a script or something to update a portal to reflect the right records from the ValueListItems calculation field.

     I tried some scripts, e.g.

     1) refresh window

     2) gotolayout[b] and bakc to origininal layout

     3) gotolayout[Metamaintable] and back to original.

     These don't work.

     What does work is changing a value in a portal row, then change it back:

     Commit Record/Request[] //to update the ValueListItems-calculation field

     Go to Object{Object Name: "List Portal"]

     Go to Portal Row[first]

     Set Field[Portal::Amount; Value: Portal::Amount + 1]

     Set Field[Portal::Amount: Value: Portal::Amount -1]

     Because the portal then updates the needed rows, but leaves the rest of the rows as before, I will get the wrong selection when I go from many portal records to a few. (The portal shows me the few updated records and then continues with the ones from the former selection.) So I solved that by:

     Go to Layout["Layout2"]

     Go to Layout[original layout]

     The problem is essentially solved, but any suggestions for a more elegant solution are welcome.