Jump to content

Copy or Duplicate multiple records per customer


Recommended Posts

Assignment: to copy 'work order' records per customer to save the customer time.

 

I have two related tables . The customer table has customer details. The other table has all the  'work orders'.

I have pulled in the 'work orders' into the customer as a portal.

I have created a button to duplicate one record.

See attached script.

QUESTION: how to copy all records per customer.

I have workorderID / customernumber id.

 

copy one record.JPG

Link to comment
Share on other sites

35 minutes ago, Sharifa said:

I have two related tables .

Are you sure about that? Looking at your script, I would think there are actually three tables involved in this: Customers, WorkOrders and a child table of WorkOrders (WorkOrderItems?). Otherwise I don't understand what the Loop section of your script does.

Anyway, if you have a script that works for one record, you can run it in a loop for a group of records - same as you do for the records in the child table. Note that in both cases you can use the Go to Related Record script step instead of a find.

 

44 minutes ago, Sharifa said:

copy 'work order' records per customer to save the customer time.

I am not sure how exactly this is supposed to "save time". I can understand that sometimes it is convenient to duplicate a previous work order instead of creating a similar one from scratch - but I cannot see the purpose of duplicating all of them.

 

  • Plus1 1
Link to comment
Share on other sites

The background if it helps.

It's a test assignment. So figuring it out myself.

It is a garden service company. A customer such as a hotel places many orders.

For example, a customer has 10 orders. 

They need to copy these 10 orders with click of the button.

see attached.

 

button for copy all records.JPG

Link to comment
Share on other sites

When I do this manoeuvre I do a find for the desired records, I then export as Get(TemporaryPath)/ordersAsTemplate.<<timestamp>>.FMPXMLRESULT.xml, and import this exported file to the same table, remember after this has been imported the data you just imported will be a selection and you can do replace on this if you need to prepare some data for the new template. Make sure you do an if for found set prior to export to avoid exporting all records in the table.

There is no shame in making a separate layout for the purpose of this export and import.

You may ask why I do XML export opposed to FileMaker Pro file type; the answer is file size, while still keeping the structure.

Edited by ggt667
  • Plus1 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.