kfok Posted September 22, 2004 Posted September 22, 2004 I have a minimum field and a maximum field. All two are number fields. If I want to find records ranging from 1 to 10, it is easily to enter >=1 in the minimum field and <=10 in the maximum field. But I don't know how to make a script to do this find. Does anyone cn help me? Thanks in advance.
Keith LaMarre Posted September 22, 2004 Posted September 22, 2004 Enter Find Mode Set Minimum to ">=1" Set Maximim to "<=10" Perform Find Or just perform this find once and have the script remember the find. be certain to turn "Error Capture On" in case 0 records are returned.
kfok Posted September 22, 2004 Author Posted September 22, 2004 I am new to FM. Can you show me to how to write out the script?
Lee Smith Posted September 23, 2004 Posted September 23, 2004 Please update your profile to reflect the platform, operating system, and version of FileMaker you are using. The link is just below your name in the box on the left, it the word "profile" in blue. Lee
kfok Posted September 26, 2004 Author Posted September 26, 2004 I wrote a find script for two number fields: Min Number and Max Number. I want to do a search to show records that have value ranging from the minmum to the maximum. Set Error Capture (On) Go to Layout ["Find"] Pause/Resume Script [] Enter Find Mode [] Set Field ["Min Number", "">=" & gMinNumber"] Set Field ["Max Number", ""<=" & gMaxNumber"] Perform Find [] When I enter numbers into the gMinNumber and gMaxNumber fields, it returns the results normally. But when one of the field is entered nothing, it shows all the records in the find results. Does anyone know how to I fix the problem?
-Queue- Posted September 26, 2004 Posted September 26, 2004 Do you want to allow either field to be empty or force both to be entered? If the former, after your Pause/Resume step, I would add If [isEmpty(gMinNumber & gMaxNumber)] Show Custom Dialog ["You didn't enter any criteria."] Go to Layout [original] Halt Script and then Enter Find Mode [ ], followed by If [not IsEmpty(gMinNumber)] Set Field [Min Number, ">=" & gMinNumber] End If If [not IsEmpty(gMaxNumber)] Set Field [Max Number, "<=" & gMaxNumber] End If Perform Find [ ] By the way, if gMax and gMin can only be whole numbers, then you can also use Set Field [Min Number, ">" & gMinNumber - 1] and Set Field [Max Number, "<" & gMaxNumber + 1], if you prefer.
Recommended Posts
This topic is 7362 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 accountSign in
Already have an account? Sign in here.
Sign In Now