August 12, 200619 yr Newbies Hi there, I would consider myself a novice to intermediate FM user. I've been using it for 3 years now but have never been able to wrap my head around the whole scripting thing (I have absolutely zero experience with scripts/macros etc, so please keep that in mind when responding ) Here's my problem... I would like to have a field that tells me the number of records, in the found set, that have a particular phrase in a certain field. For example: The field called "First Name" has multiple records with people with name "Bill". I'd like the field "total of Bills" obviously, to show the total number of Bill's there are. This is my script so far: If [First Name = "Bill"] Insert Calculated Result [Total of Bills; Count ( First Name) End If Should I have it looping so that it cycles through all the records, or does it do that automatically? I'm sure this is probably really simple, and that I'm way off. Any help is much appreciated! Kallain
August 12, 200619 yr There would be at least a couple different approaches to this. But the Loop is a good one for the found set. I'm assuming this is a temporary total, for that reason. In which case the Total of Bills field should be a Number field, with global storage; so it is accessible from every record. Yes, you need a Loop. Pseudo code: Freeze Window View As Form <- makes loops faster Set Field [ Total of Bills; 0 ] Go to Record [ First ] Loop If [First Name = "Bill"] Set Field [ Total of Bills; Total of Bills + 1 ] End If Go To Record [ Next; Exit after last ] End Loop Go to Record [ First ] View As List Edited August 12, 200619 yr by Guest Forgot the End Loop!
August 14, 200619 yr Author Newbies Thank you for your help Fenton. I tried what you suggested, unfortunately, it's only returning a result of 1, even though there are mutliple bills. I have the field "total of Bills" in a trailing grand summary part. Could this be messing things up? Thanks, Kallain
Create an account or sign in to comment