Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6898 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies
Posted (edited)

One of our developers wrote a script for running reports on employee production statistics for a project management database we are developing in FM8. The way the script works now is that when a report is run, a script runs a number of secondary scripts, each one a copy made for an employee to find their entries in a time log. Here's an example of a couple of lines from the script:

>Paste [select; PD Employee Report::Month Year]

>Insert Text [select; PD Employee Report::Employee ID; "XXX XXXX"]

This goes on for all field entries for employee XXX XXXX. The results from the secondary scripts for each employee are then compiled by the first script into a new record. Adapting this for each employee in the department using this is extremely time consuming as each instance of the field Employee ID needs to be changed to the employee's name (there are about 50-70 instances in each script, for about 20 employees). Is there any way to do a find and replace for this in the script editor in FM8, or can I export the script as a text file so I can do so?

Alternately, I suggested that XXX XXXX be replaced with a variable so that one script could be used to compile information using the field Employee ID as a key. However, I'm still in the process of familiarizing myself with scripting in FM8. If it can be done, how would I go about this?

For the time being, I'm replacing the Employee ID value with a local variable in each secondary script, but I'd prefer to wrangle it all into one script to handle the whole process.

Thanks much

Edited by Guest
Posted

FileMaker 8 has a cool function called GetNthRecord that would work great here:

Set variable( $count ; Count( employees::id) )

// assumes you have a relationship to the employees table

Set variable( $n ; 0 )

// we'll use this in the loop below

Loop

. GetNthRecord( employees::Employee ID; $n + 1 )

. /* do your other script stuff here */

...

. Exit Loop If ( $n = $count )

End Loop

Some variation of this should get you where you want to be.

This topic is 6898 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 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.