5 Replies Latest reply on Apr 8, 2010 5:25 AM by ninja

    Creating Records from A Related File



      Creating Records from A Related File


      Good Morning.

      I have 3 FM10 pro database files that are related to each other via a contact ID.  These files are called

      (1) "Contact Management" - which contains all the customer's info;

      (2) "Quoter" - Records are created here to  price a machine to quote for a customer;

      (3) "Sales" - The records that are created here are manually entered for a customer that represents a potential sale that we use to submit to finance companies for credit approval, this info is taken from a print out from the "quoter" file. This info is basically the same as the info in the quoter file. However, I have to keep this file,"Sales" and the "Quoter" file separate for other reasons.

      I want to know if a script can be created that would produce a record into the "Sales" file from The

      "Quoter" file. This eliminate alot of manual entries.



        • 1. Re: Creating Records from A Related File

          Howdy Jeff_D,


          Not a "how to" kind of answer, but a tool feature that I figure you can run with easily...


          You can call a script from the "Sales" file from within your script in "Quoter".  The script step "Perform Script" has that option available to you.  From there you're home free.

          • 2. Re: Creating Records from A Related File


            I understand the script technique but now I need to get a little more specific.

            The script in the quoter file, would the script pretty much be the of copying fields from quoter & pasting into


            • 3. Re: Creating Records from A Related File



              Me personally, I would put a table occurrence of Quoter into Sales related by ID# (didn't you say you already had this?) and have the script make a new record and perform either Lookups or SetFields to copy the data over to the new record.  Depending on how you're using it, you may need to pass the ID# along in a variable or script parameter and set the ID# of the newly created record to form the proper record to record relationship.


              I suppose import would also be a choice, but I tend to keep things simple for others to follow later on.  SetField is obvious in function to the person after me.


              While you're at this...consider how you might do without some of the data duplication.  If they're related already, can't you use the data from one file in the other without copying it?

              • 4. Re: Creating Records from A Related File

                Hello Ninja, I'm finally able to get back to creating this script.

                I have created the scripts you wrote about in a previous post.

                A script in the Sales file that calls up a script in the Quoter file.

                However, I am stuck on the end of the script in the quoter file; i.e. how to copy multiple fields from the quoter file?

                Do I use the Set Variable Option to copy the fields I need or ?

                And. in the script located in the Sales file, how does the Set Fields need to show?

                • 5. Re: Creating Records from A Related File

                  Howdy Jeff_D,


                  What I'm picturing assumes that you have a TO in Sales showing the Quoter table, linked by contactID to the Sales table.  It also assumes that you launch this script from a record in Quoter that you want to make a sale for.


                  Scipt in "Quoter":

                  SetVariable [ $$contactID ; Value: contactID]

                  Perform Script from Sales "Copy Contact Info"


                  Script in Sales:

                  GoToLayout [ the layout you want ]

                  New Record/Request

                  SetField [Sales::ContactID ; $$contactID]

                  SetField [ Sales::Name ; Quoter::Name]

                  SetField [Sales::Address ; Quoter::Address]



                  This relies on the link to your sales file...so make sure you have that first.

                  Put a TO of "Quoter" in your Sales relationship diagram and join it to your Sales table by contactID (if you haven't already)