6 Replies Latest reply on Jan 20, 2010 4:03 AM by Ungvall

    Import/ export or copy a entire post

    Ungvall

      Title

      Import/ export or copy a entire post

      Post

      FileMaker Pro 10 Advanced

       

      I need to export or copy a complete post (for example a order or invoice, with rows) and than use the exported file or copy as a template when I want to create a new order/ invoice. Is that possible? We're trying to come up with a easy way to work/ create bundles of articles (structure articles) but haven't found any solution yet.

       

      For example:

       

      If I export an order with 3 articles today (from ORDER_post) - when I want to import the order to use it again (as a template), I just can import to ORDER and the import create 3 different posts...

       

      /Ungvall

        • 1. Re: Import/ export or copy a entire post
          philmodjunk
            

          There are also ways to manage selecting an item so that you select one item that names the bundle and then a script fills in the all the individual items that make up the bundle in the line item records listed below the line where you select a bundle.

           

          Is that what you had in mind?

           

          Do you have an Invoice with a portal of related line items? (If not, you should)

          • 2. Re: Import/ export or copy a entire post
            Ungvall
              

            Yes I have an Invoice with a portal of related line items - is there a way to copy or export/ import the whole Invoice, to be able to use it as a template?

             

            /Ungvall

            • 3. Re: Import/ export or copy a entire post
              philmodjunk
                

              There are several ways. If you want to establish a list of "template invoices", you might be able to use a looked up value option for copying data from selected fields of the invoice into your new invoice record. Alternatively, you could use a script with the Import Records step to move the entire record, though this could be somewhat like killing a flee with a hand grenade in many cases and you'd have to maintain this script carefully so that design changes to your database don't mess up the imports.

               

              The thing you would get either way are the related line items records. You'd have to write a script to import them separately ( or to look up the data line by line.).

              • 4. Re: Import/ export or copy a entire post
                Ungvall
                  

                Do you have an example script on copy or import/ export that we can use?

                 

                /Ungvall

                • 5. Re: Import/ export or copy a entire post
                  philmodjunk
                    

                  a basic script would look like this:

                   

                  Freeze Window

                  #Isolate the invoice record in a single record found set in the template file by performing a find or using Go To Related Records

                  Go To Layout [InvTemplates (InvTemplates)]

                  Enter Find Mode[]

                  Set Field [Template::InvName; Invoices::gInvName]

                  Perform Find[]

                  #Import the record and assign it the correct serial number

                  Go To Layout [Invoices (Invoices)]

                  #Do not import the invoice serial number field (InvNumb) and specify "Perform auto-enter options while importing"

                  Import Records [No Dialog; "YourFileName"; Add ....]

                  Set Field [Invoices::InvNumb; $invNumb]

                  #Import selected group of Line Items

                  Set Variable [$invNumb; Value: Invoices::InvNumb]

                  Go To Layout [LineItemTemps (LineItemTemps)]

                  Enter Find Mode[]

                  Set Field [LineItemTemps::GroupName; Invoices::gGroupName]

                  Perform Find[]

                  Go To Layout [LineItems (LineItems)]

                  Import Records [No Dialog; "YourFileName"; Add ....]

                  Replace Field Contents [No Dialog; LineItems::InvNumb; $invNumb]

                  Go To Layout [Original Layout]

                   

                  Notes: 

                  Invoices::gInvName and Invoices::gGroupName must be text fields with global storage selected in field options.

                  Invoices::gInvName and Invoices::gGroupName would be formatted with value lists listing each invoice template and line item group by name.

                  Template::InvName and LineItemTemps::GroupName are text fields used to assign names to invoice templates and groups of line items.

                  Invoices::InvNumb is an auto-entered serial number field

                  Invoices and LineItems are linked via this relationship:

                   

                  Invoices::InvNumb = LineItems::InvNumb

                   

                  Both Import Records steps, must be set up with correct data source, field mapping, and import options.

                   

                  • 6. Re: Import/ export or copy a entire post
                    Ungvall
                      

                    Thank you very much!

                     

                    /Ungvall