Jump to content

StartUp Script

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

Recommended Posts

I use a small Filemaker db that keeps track of client contacts. There are fields for name, date of contact, reason for contact and result of contact. The contact layout is set to view as list and we scroll through it like a rolodex. What I don't like is to scroll through and find all 20 contacts for one client listed one after another. It's cluttered. I'd love to rescript so that only the first contact record for each client displays. To review contact history for any client would simply require a find and a find report layout. Is there a way to script so only the first record for each client is displayed?

Link to comment
Share on other sites

Create a layout that shows information for a single record (contact of a client). After you have the found set of contacts, use a script to sort the found (perhaps by date) and go to the first record.

First manually sort the data as you want the script to do so. Then open ScriptMaker and create a script entitled something like Sort by Date Ascending. Place in it a single line, Sort [ Restore ]. This will store the sort options and duplicate them when you run the script.

Assuming that you already have a script to perform the find, you would then write another script called, perhaps, Find Contacts and Go to First Record with the following lines:

Perform Script [ Find Contacts, Perform Sub-scripts ]

Perform Script [ Sort by Date Ascending, Perform Sub-scripts ]

Go to Layout [ Detail ]

Go to Record/Request/Page [ First ]

The reason I recommend placing the sort command in it's own script is that sorts are often useful to many scripts, and this way you can call the sort script from any script that needs to sort by date ascending, and you only have to store the sort once.


Link to comment
Share on other sites

This is a little complex, but it should do what you want. You will need a unique number field (not name) identifying each client. I'll call this ClientID. You will also need a unique field called RecordID:

RecordID (calculation , number) =


Create a self-join relationship (a relationship from the contact file to the same contact file) called "CLIENT" with ClientID matching ClientID. Create a field:

FirstRecFlag (calculation, number) =

Min(CLIENT::RecordID) = RecordID

This field will be a one if the record is the lowest serial numbered record for a client. This will give you one marked record per client. Perform a find setting FirstRecFlag to one. The records shown will be the first records entered for each client. -bd

Link to comment
Share on other sites

I used your RecordID suggestion down to the find. I'd prefer my users not have to go that extra step. Actually, the fewer steps the better for me as well. Instead, I changed my sort order from Last, First to RcdID, Last, First. This rolls all duplicate records to the very end. Since we'd never scroll past the last client, we end up with our perfect little rolodex without multiples.

Thanks, so much! It works beautifully even without a find.

Link to comment
Share on other sites

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