rellis32 Posted February 8, 2006 Posted February 8, 2006 I have 2 tables, 1 is for employees, 1 for Jobs. On monday I email each employee a report.pdf of the jobs they completed in the previous week. As the script stands now, it works great, I press a button, it enters find mode, i enter the employees name, it fills in some other criteria, performs the find, creates the report, saves the report as a pdf and email it using smtpit. What I would like is for this to be automated. Meaning, a looping script that would go through each of the employees names without me needing to input them individually. So my question is what would be the best way to accomplish this? To sum it up, each employee has a record in the employees table, there are 7 employees (installers). I was thinking of doing a repeating global field, but that would require updating everytime the employee list changes. What would be ideal, is to do a search of every job performed last week, grab the name of each individual installer that did a job, and then perform each report find on that list. I don't know if that's possible, but any input would be greatly appreciated. Bob
mr_vodka Posted February 8, 2006 Posted February 8, 2006 Are there more than one employee on each job? If so you will need to use a join table.
aldipalo Posted February 9, 2006 Posted February 9, 2006 Thanks to RainGirl aka Marcelle Benenati I have been able to set up quite a sophisticated email system. With her permission I have uploaded all her docs and scripts. I know you'll find your answer within her documentation. Good luck and feel free to ask for any clarifications. If you would like to get to Marcelle directly let me know and, with her permission, I'll give you her contact info. Al Send_Email_Script.zip
rellis32 Posted April 11, 2006 Author Posted April 11, 2006 Thank You for your help! I have completed this script, actually figured it out in about an hour, it's just been a while since I visited this subject because of more pressing issues Anyway, This is basically how I did it: Set Variable [ $names; Value:ValueListItems ( "Database" ; "InstallerNames" ) ] Set Variable [ $number; Value:ValueCount ( $names ) ] Set Field [ Vantive::Assingned To; GetValue( $names ; $number ) ] That is the nuts and bolts, I used that inside a loop, decreasing $number by 1 every loop and exiting if $number = 0. I also included an error capture, so if an installer did not work one week, it wouldn't pop up with a "no record found". The reason I went this route it I wanted to be fairly dynamic. The InstallerNames valuelist if pulled from an installer table, so if an installer leaves, his record is deleted or if one is hired, his record is created there, thus adding him/her to the list. Now all I have to do is hit the button, it emails each installer individually their weekly report in .pdf format with smtpit. Thanks again for your help. Hopefully this will give someone some insite in the future. If anyone would like the whole script let me know, I will post it, it's just rather lengthy.... Bob
Recommended Posts
This topic is 6803 days old. Please don't post here. Open a new topic instead.
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 accountSign in
Already have an account? Sign in here.
Sign In Now