Jump to content

Script to duplicate with new job number multiple times

Recommended Posts

  • Newbies


Im having a play with fm pro on a friends pc for my mowing business, its really good as i can customise it how i want. 

My scenario is. I have multiple customers that have regular bookings like every 2 weeks. 

When i add a new job i would like to before commit select a  "Frequency" and "FrequencyRepeat"

So when i add newjob , i would fill in the details and mowing date then select every 2 weeks and repeat 20 times, then hit create order, this will then save this order and copy the same order but with the new order number and also the right dates. 

Im hoping this is possible as at some point i want to have this sync to google calendar too but thats at a later date. 


I look forward to any help or response. 

Thank you

Link to post
Share on other sites

I would suggest you use 3 tables: Customers, Orders and JobDates. That way no information needs to be duplicated.

As for creating the records in the JobDates table, this should be easy enough using a looping script. However, in addition to frequency and the number of repeats, you also need to supply a starting date. Then your script can look something like:

Set Variable [ $orderID ; Orders::OrderID ]
Set Variable [ $startDate ; Orders::StartDate ]
Set Variable [ $frequency ; Orders::Frequency ]
Set Variable [ $repeats ; Orders::Repeats ]
Go to Layout [ JobDates ]
  Exit Loop If [ not $repeats ]
  New Record 
  Set Field [ JobDates::OrderID ; $orderID ]
  Set Field [ JobDates::Date ; $startDate ]
  Set Variable [ $startDate ; $startDate + 7 * $frequency ]
  Set Variable [ $repeats ; $repeats - 1 ]
End Loop
Go to Layout [ original layout ]

Note that this example assumes the frequency will always be given in weeks (it doesn't have to be). And it could be further improved by making sure the list is not duplicated if you accidentally push the button again.



Edited by comment
Link to post
Share on other sites

I would consider a different overall approach.  If you are the only one mowing, you may be better off reconciling at the end of the day, then generating a schedule for tomorrow.
IDK if pre-programming all your cuts for the summer (season) is a good idea, as a few days of heavy rain (even one day) throws the entire schedule out the window.
And if you don't get all of today's cuts done (weather, equipment break down, etc.), you'll have to make another adjustment.  I also wouldn't even bother with syncing to Google.  That's a lot of alerts, all day, everyday.

Every morning, or night before, with a simple search script you could generate a list based on frequency and 'next cut'.  You could even group them by location and look at them on a map.

And all of this can be on FM go on an iPhone/iPad

Edited by Steve Martino
Link to post
Share on other sites
  • Newbies

Hi, thanks for your responses. Im hoping im setting it all up right. 

I lost my job with covid and decided to use my love for the garden to do super discount garden services for the aged, disability and people not able to do their own things. Im hoping to add an offsider to help me if i get really busy. 

Im not making money hardly doing this but its giving me a bit of a wage and i feel happy im helping out them in need :)

If anyone would like to help me with this initial setup i would appreciate it. I have setup the layouts, job page, new customer etc.



Link to post
Share on other sites
On 4/26/2021 at 6:24 PM, comment said:

I would suggest you use 3 tables: Customers, Orders and JobDates. That way no information needs to be duplicated.

I like this approach, however if you are working on a Mac I would do a double filing of JobDates in FileMaker and in Calendar, not sure how this would work if you are on Windows though.

Edited by ggt667
Link to post
Share on other sites
  • Newbies

no fairies to help setup the file the proper way.... Oh well back to the drawing board :)

GGT667. I will only be using on PC

Link to post
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
  • Create New...

Important Information

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