Jump to content
Server Maintenance This Week. ×

How to script to select the next value in a generated value list?


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

Recommended Posts

  • Newbies

I am working in FMP 5 and need to create a script to Find records of all jobs, which have 5 or more separate records -- e.g., 00-1234 has 6 records, 00-0123 has only 2 records.

I can create a value list from the Job Number field, but I am stuck as to how to select the first value, perform a Find, check status, set flag for the Find and then go on to the next value in the value list.

Any help will be appreciated. I searched the ScriptMaker forum, but did not find exactly what I am facing.

TIA

Link to comment
Share on other sites

You say that job A has five records and job B has 2 records. Are jobs kept in one database and the records that jobs have kept in another database? If so, you can use the Count function to find out how many related records there are for a job. Count the Job ID field in the database with job records, and you'll get a number of records for a job.

Chuck

Link to comment
Share on other sites

If all records are in the same database, you can build a self relationship with JobID matching JobID. Call this relationship "Self by Job". Then create a calculated field:

Job Count (calculation,number) =

Count(Self by Job::JobID)

Perform a find entering ">=5" into the Job Count field. This will be somewhat slow for a large file (it's an unindexed find because of the relationship) but should still be faster than a looping script. -bd

Link to comment
Share on other sites

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