5 Replies Latest reply on Nov 30, 2009 10:48 AM by rahpe

Script to determine whether certain data is included within a group of records

Title

Script to determine whether certain data is included within a group of records

Post

Let's say I have 200 records of scores obtained by 18 of 25 possible players. Within a script I am going through the scores one player at a time to total each players scores...BUT when I come to a player who has no score records I get an error that "No records match my criteria"

Question:

How do I get the script to ignore this and simply move on to the next player?

• 1. Re: Script to determine whether certain data is included within a group of records
Solved it myself, thanks for looking.
• 2. Re: Script to determine whether certain data is included within a group of records

And, in the spirit of the Forum, that solution was...?

!-)

• 3. Re: Script to determine whether certain data is included within a group of records
My solution was to give every player an initial record of a zero score. I then ignored that score in further calculations of averages, etc...Thus the record FIND always came up with at least one record, which I ignored, but no error message.
• 4. Re: Script to determine whether certain data is included within a group of records

A simpler way to disable the dialog:

Set Error capture [on]

Perform find[]

Set error capture will supress the "no records" dialog box from popping up and you can use get ( foundcount ) to check to see if any records were found.

On a design note: Why on earth are you using a script to "go[] through the scores one player at a time to total each players scores" ?

This sounds like an something that could be done with either a calculation or summary field with no scripting at all needed.

• 5. Re: Script to determine whether certain data is included within a group of records

Of course there is more to it.

I could have up to 25 players each with up to 25 scores and I am keeping a tally of the total of up to the top 13 scores for each player.

First I get all scores, find those of a specific player then sort them in inverse order of scores because I want to total only the top 13 of a total of up to 25 scores. I then go through them until I get to the last record, or the 13th record in the series, log the total and move on to the next player. It works very well, and since my phony zero record is always at the end of the list it is of no effect.

Thanks for the tips on error capture and foundcount I will try them out and keep them in mind.