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.

find and replace in scripts

Featured Replies

  • Newbies

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

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.

  • Author
  • Newbies

Thanks much!

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.