8 Replies Latest reply on Oct 10, 2012 2:27 PM by Emmanuel

    Duplicate records with portal

    Emmanuel

      Title

      Duplicate records with portal

      Post

           I have been looking around the forum concerning the way to copy a record including its related portals informations. I have tried 2 different script and none seems to be working properly.

           Case 1 :  http://forums.filemaker.com/posts/ac6afe2913

           how to integrate the   /* there are line items to duplicate */ ?

            

           Case 2:   http://forums.filemaker.com/posts/0e5d386ecf

           that one does not copy the portal data.

            

           Could you suggest another script (or modify one) ? My case is similar the the second case in the sense that I want to be able to copy invoices (it is even based on the FM 12 starter solution).

            

           Thank you

        • 1. Re: Duplicate records with portal
          philmodjunk

               The script in Case 1 should do exactly what you need.

               Can you explain your question more fully?

               I don't know what you mean by:

               

                    how to integrate the   /* there are line items to duplicate */ ?

               /* there are line items to duplicate */

               Is simply a comment. Text enclosed in /*   */ is ignored in a calculation such as this. You can type it in exactly as shown or leave it out and the script will perform the same.

          • 2. Re: Duplicate records with portal
            Emmanuel

                 So here are the results I get with the first script. When I click a the button that activates the script I get a pop up windows that asks me for a record number out of the total + 1 ( I have 3161 invoices and thus allows me to choose up to 3162). I figured out that I needed to put 3162. Once it press ok, I see a new invoice record with the invoice's data on it. 

                 Yet, the child data (from invoice data) are not associated with it. Actually, these invoice data from the portal that I wanted to duplicate have been created (as I can see in the invoice data layout). However, no Invoice ID is written on it when it should be with the (serial) new invoice ID.

                  

                 As for my previous question, I am wondering the text line is meant to annonce what the line does or if it is to mention that extra field should be added to have them copied.

                  

                  

                  

            • 3. Re: Duplicate records with portal
              philmodjunk

                   When I click a the button that activates the script I get a pop up windows that asks me for a record number

                   This script step appears several times in the script:

                   Go To Record/Request/Page

                   One of those is not set up correctly. The value Previous, first, or next should be selected from the Specify drop down. It appears that the "by calculation" option was selected instead and this can pop up the dialog you are describing.

              /* there are line items to duplicate */

              Is simply a comment documenting that portion of the script.

              If you still have trouble, you may want to post your copy of the script.

                   To post a script to the forum:

                     
              1.           You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
              2.      
              3.           You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here.
              4.      
              5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
              6.      
              7.           If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format. (Use the HTML option on the database tab panel and paste the text into the forum's HTML editor.)
              • 4. Re: Duplicate records with portal
                Emmanuel

                     Indeed, the calculation as been made to do the following line:

                Go To Record/Request/Page [$RecordNumber]

                A screenshot has been joined to this message to show you what I got. Just to let you understand what it is about, it is based on invoice starter solution but is actually being modified to be a formula database. Just like the logic behind invoices is 

                Customer > may have many "Invoices" > that are made out of various "products"

                the formula modifications are

                a "research project" > are made of many "lots"  (or samples)  > that are made out of various "ingredients"

                      

                • 5. Re: Duplicate records with portal
                  philmodjunk

                       Apologies.

                  Go To Record/Request/Page [$RecordNumber]

                       Is correct and should be the step immediately after the

                       Set Variable [$LotID

                       step. But the "perform without dialog" check box needs to be selected to keep the confirimation dialog from appearing.

                       This was a final adjustment made to the script to make sure that it works even if the parent record is not the last record in the found set.

                  • 6. Re: Duplicate records with portal
                    Emmanuel

                         Ok!! I have been progressing with that scripting.... the only thing left that is not rigth is that the ingredients names (or product name on invoice equivalent) are "new item"  instead of the actual values ?!?

                    • 7. Re: Duplicate records with portal
                      philmodjunk

                           Do you have an auto-enter calculation that may be updating these fields with "new item"? You'll need to figure out how that text is entered into the field in the first place before you can take steps to prevent it.

                      • 8. Re: Duplicate records with portal
                        Emmanuel

                             You are really sharp!! That's it!