November 11, 200421 yr Ok, I've got a staff database with many classifications for position, and I want a tally for how many of each position have been hired. So I defined a Global variable for each possibility wrote a script to count each and store it in the respective globals... the script does a search, moves to the last record, then sets the value of the global to the current record count, which gives me a number I can then display on the layout. However when there are no hires for a certain position, the whole thing blows up. It gives me a "search returned no results" dialog and bails. What I'd like is to get a 0 value on positions that have no hires, and continue counting this would be so much easier (or at least I'd understand it) with SQL... how should I approach this sort of problem in Filemaker?
November 11, 200421 yr Add Set Error Capture [On] to the beginning of your script. After the find is performed, add If [not Status(CurrentFoundCount)] Set Field [global, 0] Else {the remainder of your steps} End If It would be faster to do this using a relationship. Create a relationship between a global text field and the classification field. Then create a looping script to set the global with each classification and the Count(relationship::serial) to the respective global number field.
November 11, 200421 yr I would add a Position file, related to Staff by PositionID, then use a calc with Count(Staff::StaffID) to show the number in each position. This design can also help by giving you a place for default values for each position, or HR can keep job descriptions in there.
Create an account or sign in to comment