2 Replies Latest reply on Dec 6, 2012 6:35 AM by Terri

    Script Help

    Terri

      Title

      Script Help

      Post

           I have a layout that has a portal on it. I also have a button outside of the portal that when pushed, will set certain fields outside of the portal to a certain value. That all works great. But I also want the script attached to this button to change a field in each of the rows of the portal as well (actually - delete the contents of this field on all portal rows). I can't seem to get it to work. Here is what I have so far:
            
           Set Field [WorkhorseStyles::SS Style Reviewed; ""]
           Set Field [WorkhorseStyles::SS On Figure Commander Ready; ""]
           Set Field [WorkhorseStyles::SS Laydown Commander Ready; ""]
           Set Field [WorkhorseStyles::SS On Figure Shot Complete; ""]
           Go to Portal Row [Select; First]
           Loop
              Set Field [WorkhorseData::Update Comment; ""]
              Go to Portal Row [Select; Next; Exit after last]
           End Loop
            
           When I watch through script debugger it follows eveything up to the Loop and then I can't seem to see any action.
            
           Any help is appreciated. Thanks!

        • 1. Re: Script Help
          philmodjunk

               How many portals are on this layout?

               Note that Go to Portal Row lacks a parameter for specifying which portal it should interact with so if you have more than one portal, it may be attempting to loop through the portal rows of a different portal.

               If that's the case, you can give the portal an object name using the name box in the inspector and then you can use Go to Object ["portalNameHere"] just before the first go to portal row step to put the focus on the correct portal.

               You could also use this script:

               Set Field [WorkhorseStyles::SS Style Reviewed; ""]
               Set Field [WorkhorseStyles::SS On Figure Commander Ready; ""]
               Set Field [WorkhorseStyles::SS Laydown Commander Ready; ""]
               Set Field [WorkhorseStyles::SS On Figure Shot Complete; ""]
               If [ Not IsEmpty ( WorkhorseData::ForeignKey ) // check for any related records ] ---> use the name of your foreign key field here in place of mine
                 Freeze Window

                 Go To Related Record [Show only related records; From table: WorkhorseData; Using layout: "WorkhorseData" (WorkhorseData)]
                 Replace Field Contents [no dialog ; WorkhorseData::Update Comment; "" ]
                 Go to Layout [original layout]
               End If

          • 2. Re: Script Help
            Terri

                 After giving the portal an object name the script I had created (modified slightly) worked perfectly. Thank you!