Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Find range script


kfok

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

Recommended Posts

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.

Link to comment
Share on other sites

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

cool.gif

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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