1 Reply Latest reply on Nov 23, 2011 11:02 AM by philmodjunk

    Using "Set Field" in Portals



      Using "Set Field" in Portals


       I have three tables: 1) Youth, 2) Events and 3) List (all events a youth is signed up for)

      My layout is "Showing Records from" the Youth Table and it has two portals on it: 1) Events and 2) List

      I have a script that works most of the time but oddly not allways.  My script copies an "Eevent serial number" field from the EEvent portal to the "LList serial number" in the Llist Portal (last record), The paste goes into the last record (an empty one causing a look up).

      Most of the time the copy paste works - others it doesn't.  Actually if I manually go into the "Eevent serial number" field and manually copy it, it will sometimes not manually paste into the "Llist serial number" field - though the "Eevent serial number" is on the clipboard and can be pasted in i.e., Word.

      I have read the forum and am thinking "Set Field" is the beginning of a fix BUT, how do I direct the script to copy from the proper "Eevent serial number" row/record and how do I direct the script to "Set Field" into the last (empty) row in the "Llist serial number" portal?

      Thanks ANYONE!  I've spent days and really am stuck!

        • 1. Re: Using "Set Field" in Portals

          I only use copy and paste if there are no other ways to do what I want and such circumstances are pretty rare. Copy destroys any data that a user has copied to the clipboard previously and discovering that a paste from the clipboard no longer pastes the data they copied confuses and irritates them.

          How are your relationships setup?

          This could be set up like this:


          so that List acts as a join table linking a record in Youth to a specified Event record.

          Take a look at this demo file that matches contacts (think youth) to events: http://www.4shared.com/file/dZ0bjclw/ManyToManywDemoWExtras.html

          This demo file uses set field to update portal records on some layouts where this was necessary to make that specific layout work. Other layouts in this demo do not need this feature as you can also use drop down lists of Events instead of a second portal.

          The check boxes layout should be pretty close to what you have and uses set field to do what's needed here.

          The most likely explanation why your script doesn't work is that you have two portals on your layout and your script interacts directly with the portal. Script steps like Go To Portal Row do not have a parameter for specifying the intended portal. Thus, if you have more than one on your layout, it will interact with whatever portal currently has the "focus". To specify the correct portal, you give each portal an object name and then use Go to Object to select the correct portal before manipulating the records and data displayed in the portal. In my demo file, the scripts avoid this issue by changing layouts and creating the new record on a layout that is directly based on the portal's table then switches back.