Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Email report script

Featured Replies

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

Are there more than one employee on each job? If so you will need to use a join table.

  • Author

Nope, just 1 installer per job.

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

  • 2 months later...
  • Author

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 :P

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

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.