1 Reply Latest reply on Dec 16, 2014 9:43 AM by philmodjunk

    Copying all rows from portal into new portal Script

    AlejandraGarcia

      Title

      Copying all rows from portal into new portal Script

      Post

      Hi, I would like to copy all rows from portal 1 (just one field) to portal 2 (in which there are several fields and one of them should have the information from portal 1).

      How could I do that in a script?

      Thanks

       

        • 1. Re: Copying all rows from portal into new portal Script
          philmodjunk

          Set Variable [$List ; value: List ( Portal1::Field ) ]
          Set Variable [$ID ; LayoutTable::PrimaryKey ]
          Go to layout ["Portal2Table" (Portal2Table) ]
          Loop
             Set Variable [$K ; value $K + 1]
             Exit loop if [$K > valueCount ( $List ) ]
             New Record/Request
             Set Field [Portal2Table::ForeignKey ; $ID ]
             Set Field [Portal2Table::Field ; GetValue ( $List ; $K ) ]
          End Loop
          Go to Layout [original layout]

          A note of caution, a layout that changes layouts can trip quite a few script triggers that might be set up on either layout and a script performed by such a trigger will then interrupt this script--possibly interfering with this script's correct execution.