1 2 Previous Next 16 Replies Latest reply on Oct 20, 2015 5:44 AM by hanstrager

    Copy content of portal without line items

    hanstrager

      I have a small homemade database that gathers different information about specific garments.

      I've made a new table called factory pricing which is joined with my main table called 'Technical sheet'

      On my technical sheet layout I have a portal where I can add pricing from different factories (factory pricing table).

      But when i copy my 'Technical sheet record' nothing is carried over into the duplicated portal.

      I've tried to modify an earlier script I've been using to great success. Though In those previous instances had line Items tables. Though i don't see why I should use lines in this particular scenario.

      What do i do wrong?

       

       

      Freeze Window
      Set Variable
      [ $RecordNumber; Value:Get ( RecordNumber ) ]

      #The 'set variable' for go to dublicated record

      Commit Records/Requests

      Set Variable [ $NewRecordNumber; Value:Get(RecordNumber) ]

      Set Variable [ $TECHSHEETID; Value:TECHNICAL SHEET 2::xTechnical sheet_ID ]

      Go to Record/Request/Page [ $RecordNumber ] [ No dialog ]

      If [ not IsEmpty(Factory pricing::XfactorypriceID) ]
      Go to Related Record [ From table: “Factory pricing”; Using layout: “Factory pricing” (Factory pricing) ] [ Show only related records ]

      Go to Record/Request/Page [ First ]

      Loop

      Duplicate Record/Request

      Set Field [ Factory pricing::XfactorypriceFK; $TECHSHEETID ]

      Omit Record

      Go to Record/Request/Page [ First ]

      Omit Record

      Exit Loop If [ Get ( FoundCount )=0 ] End Loop

      Go to Layout [ original layout ]
      Go to Record/Request/Page [ $NewRecordNumber ] [ No dialog ]

      End If

       

       

      Screen Shot 2015-10-17 at 14.42.06.png

        • 1. Re: Copy content of portal without line items
          siplus

          Try a Commit between these 2 lines


          Set Field [ Factory pricing::XfactorypriceFK; $TECHSHEETID ]

          Omit Record

          • 2. Re: Copy content of portal without line items
            hanstrager


            Thanks for getting back. Tried a 'Commit'  but didn't work out.

            Not sure why I can get this working

            • 3. Re: Copy content of portal without line items
              wimdecorte

              We can't see enough from the script and the screenshot.  When you step through the script with the debugger on, where does it fail?

               

              This section of the script is weird:

               

              Set Variable [ $RecordNumber; Value:Get ( RecordNumber ) ]

              #The 'set variable' for go to dublicated record

              Commit Records/Requests

              Set Variable [ $NewRecordNumber; Value:Get(RecordNumber) ]


              The commit does not change records so $recordNumber and $newRecordNumber will have exactly the same value...

              • 4. Re: Copy content of portal without line items
                siplus

                I'd also put a custom dialog showing get(FoundCount) after the

                 

                Go to Related Record [ From table: “Factory pricing”; Using layout: “Factory pricing” (Factory pricing) ] [ Show only related records ]


                • 5. Re: Copy content of portal without line items
                  hanstrager

                  This is the whole script:

                   

                  Freeze Window

                  Set Variable [ $RecordNumber; Value:Get ( RecordNumber ) ]

                  #The 'set variable' for copying auto-enter data in switches

                  Set Variable [ $radiobuttonPictures; Value:TECHNICAL SHEET::Picture switch ]

                  Set Variable [ $radiobuttonProduction; Value:TECHNICAL SHEET::ProductionSampling switch ]

                  Duplicate Record/Request

                  Set Field [ TECHNICAL SHEET::Picture switch; $radiobuttonPictures ]

                  Set Field [ TECHNICAL SHEET::ProductionSampling switch; $radiobuttonProduction ]

                  #The 'set variable' for go to dublicated record

                  Commit Records/Requests

                  Set Variable [ $NewRecordNumber; Value:Get(RecordNumber) ]

                  Set Variable [ $TECHSHEETID; Value:TECHNICAL SHEET::xTechnical sheet_ID ]

                  Go to Record/Request/Page [ $RecordNumber ] [ No dialog ]

                  If [ not IsEmpty(Line Items Fabric::TechSheetID_FK) ]

                  Go to Related Record [ From table: “Line Items Fabric”; Using layout: “LINE ITEMS Fabrics” (Line Items Fabric) ] [ Show only related records ]

                  Go to Record/Request/Page [ First ]

                  Loop

                  Duplicate Record/Request
                  Set Field
                  [ Line Items Fabric::TechSheetID_FK; $TECHSHEETID ]

                  Omit Record
                  Go to Record/Request/Page
                  [ First ]

                  Omit Record

                  Exit Loop If [ Get ( FoundCount )=0 ]

                  End Loop

                  Go to Layout [ original layout ]
                  Go to Record/Request/Page [ $recordNumber ] [ No dialog ]

                  End If

                  If [ not IsEmpty(line items zip::xZip_ID) ]
                  Go to Related Record [ From table: “line items zip”; Using layout: “LINE ITEMS zip” (line items zip) ] [ Show only related records ]

                  Go to Record/Request/Page [ First ]

                  Loop

                  Duplicate Record/Request
                  Set Field
                  [ line items zip::xtechsheetFK; $TECHSHEETID ]

                  Omit Record
                  Go to Record/Request/Page
                  [ First ]

                  Omit Record

                  Exit Loop If [ Get ( FoundCount )=0 ] End Loop

                  Go to Layout [ original layout ]
                  Go to Record/Request/Page [ $recordNumber ] [ No dialog ]

                  End If

                  If [ not IsEmpty(line items button::xButton_ID) ]

                  Go to Related Record [ From table: “line items button”; Using layout: “LINE ITEMS button” (line items button) ] [ Show only related records ]

                  Go to Record/Request/Page [ First ]

                   

                  Duplicate Record/Request
                  Set Field
                  [ line items button::xtechsheetFK; $TECHSHEETID ]

                  Omit Record
                  Go to Record/Request/Page
                  [ First ]

                  Omit Record

                  Exit Loop If [ Get ( FoundCount )=0 ]

                  End Loop

                  Go to Layout [ original layout ]
                  Go to Record/Request/Page [ $recordNumber ] [ No dialog ]

                  End If

                  If [ not IsEmpty(line items other::xother_ID) ]

                  Go to Related Record [ From table: “line items other”; Using layout: “LINE ITEMS other” (line items other) ] [ Show only related records ]

                  Go to Record/Request/Page [ First ]

                  Loop

                  Duplicate Record/Request
                  Set Field
                  [ line items other::xtechsheetFK; $TECHSHEETID ]

                  Omit Record
                  Go to Record/Request/Page
                  [ First ]

                  Omit Record

                  Exit Loop If [ Get ( FoundCount )=0 ] End Loop

                  Go to Layout [ original layout ]
                  Go to Record/Request/Page [ $NewRecordNumber ] [ No dialog ]

                  End If

                  If [ not IsEmpty(Factory pricing::XfactorypriceID) ]
                  Go to Related Record [ From table: “Factory pricing”; Using layout: “Factory pricing” (Factory pricing) ] [ Show only related records ]

                  Go to Record/Request/Page

                  [ First ]

                  Loop

                  Duplicate Record/Request
                  Set Field
                  [ Factory pricing::XfactorypriceFK; $TECHSHEETID ]

                  Commit Records/Requests

                  Omit Record

                  Go to Record/Request/Page [ First ]

                  Omit Record

                  Exit Loop If [ Get ( FoundCount )=0 ]

                  End Loop

                  Go to Layout [ original layout ]
                  Go to Record/Request/Page [ $recordNumber ] [ No dialog ]

                  End If

                  Set Field [ TECHNICAL SHEET::STYLE version; "" ]

                  Go to Field [ TECHNICAL SHEET::STYLE version ]

                   

                   

                   

                  It's the italic bottom bit that's causing trouble.

                  • 6. Re: Copy content of portal without line items
                    erolst

                    Can we summarize that you have

                     

                    • a TechnicalSheet table

                    • which has related pricing records per factory

                     

                    and that you wish to

                    • duplicate a TechnicalSheet record,

                    • including any related pricing records

                    ?

                     

                    I think you're capturing the wrong PK; wouldn't you need:

                     

                    # [ on TechnicalSheet record to be duplicated ]

                    Set Variable [ $oldNumber ; Get ( RecordNumber )

                    Duplicate Record

                    Set Variable [ $newNumber ; Get ( RecordNumber ) ]

                    Set Variable [ $newTechSheetID ; PK ]

                    Go To R/R [ $oldNumber ]

                    If [ not IsEmpty ( FactoryPricing::PK ) ]

                    Go To RR [ from: FactoryPricing; matching only; current only ]

                    Go To R/R [ first ]

                    Loop

                        Duplicate

                        Set Field [ FactoryPricing::techSheetFK ; $newTechSheetID ]

                        Omit

                        Go to R/R [ first ]

                        Omit

                        Exit Loop if [ not Get ( FoundCount ) ]

                      End Loop

                    End If

                    Go to R/R [ $newNumber ]

                    • 8. Re: Copy content of portal without line items
                      hanstrager

                      Sorry to ask, but what does PK mean?

                      • 10. Re: Copy content of portal without line items
                        hanstrager

                        Just to answer a previous question I have my main table Techsheet - with gathers all different information about a garment. type and size of buttons, zips and fabric. Hence the long duplicate script.

                        I tried erolst's script (see italic bottom bit) but still nothing copied and it copies the record twice:

                         

                         

                        Freeze Window

                        Set Variable [ $RecordNumber; Value:Get ( RecordNumber ) ]

                        #The 'set variable' for copying auto-enter data in switches

                        Set Variable [ $radiobuttonPictures; Value:TECHNICAL SHEET::Picture switch ]

                        Set Variable [ $radiobuttonProduction; Value:TECHNICAL SHEET::ProductionSampling switch ]

                        Duplicate Record/Request

                        Set Field [ TECHNICAL SHEET::Picture switch; $radiobuttonPictures ]

                        Set Field [ TECHNICAL SHEET::ProductionSampling switch; $radiobuttonProduction ]

                        #The 'set variable' for go to dublicated record

                        Commit Records/Requests

                        Set Variable [ $NewRecordNumber; Value:Get(RecordNumber) ]

                        Set Variable [ $TECHSHEETID; Value:TECHNICAL SHEET::xTechnical sheet_ID ]

                        Go to Record/Request/Page [ $RecordNumber ] [ No dialog ]

                        If [ not IsEmpty(Line Items Fabric::TechSheetID_FK) ]

                        Go to Related Record [ From table: “Line Items Fabric”; Using layout: “LINE ITEMS Fabrics” (Line Items Fabric) ] [ Show only related records ]

                        Go to Record/Request/Page [ First ]

                        Loop

                        Duplicate Record/Request
                        Set Field
                        [ Line Items Fabric::TechSheetID_FK; $TECHSHEETID ]

                        Omit Record
                        Go to Record/Request/Page
                        [ First ]

                        Omit Record

                        Exit Loop If [ Get ( FoundCount )=0 ]

                        End Loop

                        Go to Layout [ original layout ]
                        Go to Record/Request/Page [ $recordNumber ] [ No dialog ]

                        End If

                        If [ not IsEmpty(line items zip::xZip_ID) ]
                        Go to Related Record [ From table: “line items zip”; Using layout: “LINE ITEMS zip” (line items zip) ] [ Show only related records ]

                        Go to Record/Request/Page [ First ]

                        Loop

                        Duplicate Record/Request
                        Set Field
                        [ line items zip::xtechsheetFK; $TECHSHEETID ]

                        Omit Record
                        Go to Record/Request/Page
                        [ First ]

                        Omit Record

                        Exit Loop If [ Get ( FoundCount )=0 ]

                        End Loop

                        Go to Layout [ original layout ]
                        Go to Record/Request/Page [ $recordNumber ] [ No dialog ]

                        End If

                        If [ not IsEmpty(line items button::xButton_ID) ]

                        Go to Related Record [ From table: “line items button”; Using layout: “LINE ITEMS button” (line items button) ] [ Show only related records ]

                        Go to Record/Request/Page [ First ]

                         

                         

                         

                         

                        Duplicate Record/Request
                        Set Field
                        [ line items button::xtechsheetFK; $TECHSHEETID ]

                        Omit Record
                        Go to Record/Request/Page
                        [ First ]

                        Omit Record

                        Exit Loop If [ Get ( FoundCount )=0 ]

                        End Loop

                        Go to Layout [ original layout ]
                        Go to Record/Request/Page [ $recordNumber ] [ No dialog ]

                        End If

                        If [ not IsEmpty(line items other::xother_ID) ]

                        Go to Related Record [ From table: “line items other”; Using layout: “LINE ITEMS other” (line items other) ] [ Show only related records ]

                        Go to Record/Request/Page [ First ]

                        Loop

                        Duplicate Record/Request
                        Set Field
                        [ line items other::xtechsheetFK; $TECHSHEETID ]

                        Omit Record
                        Go to Record/Request/Page
                        [ First ]

                        Omit Record

                        Exit Loop If [ Get ( FoundCount )=0 ]

                        End Loop

                        Go to Layout [ original layout ]
                        Go to Record/Request/Page [ $NewRecordNumber ] [ No dialog ]

                        End If

                        #on TechnicalSheet record to be duplicated

                        Set Variable [ $oldNumber; Value:Get ( RecordNumber ) ]
                        Duplicate Record/Request
                        Set Variable
                        [ $newNumber; Value:Get ( RecordNumber ) ]
                        Set Variable [ $newTechSheetID; Value:TECHNICAL SHEET::xTechnical sheet_ID ] Go to Record/Request/Page [ $oldNumber ]

                        If [ not IsEmpty(Factory pricing::XfactorypriceID) ]

                        Go to Related Record [ From table: “Factory pricing”; Using layout: <Current Layout> ]

                        Go to Record/Request/Page

                        [ First ] Loop

                        Duplicate Record/Request
                        Set Field
                        [ Factory pricing::XfactorypriceFK; $newTechSheetID ] Omit Record
                        Exit Loop If
                        [ not Get (FoundCount) ]

                        End Loop

                        End If

                        Go to Record/Request/Page [ $newNumber ]

                        Set Field [ TECHNICAL SHEET::STYLE version; "" ]
                        Go to Field [ TECHNICAL SHEET::STYLE version ]

                         

                         

                         

                         

                        Screen Shot 2015-10-18 at 14.04.25.png

                        • 11. Re: Copy content of portal without line items
                          hanstrager

                          sorry didn't think siplus

                          • 12. Re: Copy content of portal without line items
                            siplus

                            You also could try

                             

                            - go to a temp table;

                            - delete all records;

                            - import related records ;

                            - replace field contents PK;

                            - import records in main table.

                             

                            If solution is server-based, you use an additional field based upon Get(PersistentID) to find and delete records generated by the current client.

                            • 13. Re: Copy content of portal without line items
                              hanstrager

                              Not entirely sure how to do any of those.

                              Isn't there just an easy script that'll copy my records in my portal and let them show in my duplicated techsheet record?

                              • 14. Re: Copy content of portal without line items
                                siplus

                                Define "easy".

                                1 2 Previous Next