I am trying to build a small application to create PM work orders for machinery. I need to write an agent (I guess) to calc which machines should be PM’ed, fill in the appropriate information on a special workorder form, then print the forms for the qualifying machines. I have the forms and views already made. I am stuck, however, on how to use an agent to do the calcs, fill the form, and then print the forms. Is this possible or have I wasted my time with what I have already created. I know this is pretty vague, but I wanted to keep it short. TIA – Mike
Subject: Need agent to fill & print form
Somewhere you need to have a way to define the PM interval or next due date for each machine - somewhere one or more docs need to exist with this data.
Once the data exists, a scheduled agent reads the list of machines, looks for due dates that are coming up, and creates a new scheduling doc/workorder.
I’m not sure if you can print via scheduled agents - never tried it. If you can, the printer will need to be available to the server since that’s what’s running the agent.
If you’re not interested in scheduled agents, you could use similar logic and have a person run the code - this way, you can easily generate the printouts.
I know this is pretty vague, but… ![]()
HTH
Doug
Subject: RE: Need agent to fill & print form
Doug, thanks so much for your response. I have a 'Machine Master" form that contains the last PM date, the PM frequency (in days) and a field to hold the next PM date (among other things). I have a button on a view that runs an agent to calc the next PM based on last PM and frequency and it calcs it fine. From this point, I need it to then look at the newly calc’d PM date and and determine if the records meet =< @Today… if it does, populate the appropriate fields on a ‘workorder’ form and print that form… one form for each machine. I want the agent to remain running from the button as that way, we have control over when it is run. You appear to have a grasp of what I am trying to accomplish. Hope this helps you help me
– Mike
Subject: RE: Need agent to fill & print form
Sorry about the delay responding - I’ve been out of the office and off-line since last Thursday.
I am guessing that your code is written in @Functions. If you want to create new docs based on the date, you could do it in @Language(*), but you’re better of switching to LS. You have the flow of the code in your grasp - just start writing.
Doug
(*) The doc you need to create would have fields defaulted to environmental variables. The agent would decide when to create a doc, push out the appropriate Env vars, then do an @Command([Compose];“yourForm”) and save the doc, probably in an @Do loop that is part of an @If loop. This will work (I think, haven’t tried it so can’t guarantee it will work), but the screen will be very busy as forms pop up and then disappear. With LS it all happens in the background.