Jump to content

Scripting: Sort By


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

Recommended Posts

  • Newbies

I made a script called "Search for", the idea was to make a search that would allow the users to search for a list of results. Things like

Booked, Missed, CBRS, Dispute, Special, etc....

Everything is working fine, up until the point after where you click the option that you want to search for. It comes up with the menu and when you select "Booking" , it will search for "Booking", however it will only search "Apptresult" and it wont search the other 3 boxes "Apptresult2" or "Apptresult3" or "Apptresult4".

What i want it to do is search the 4 boxes and search for what ever is selected in the menu. I also want it to search the 4 boxes, just not the "Apptresult" boxes.

I have attached a Screen shot to show you the source code. Maybe someone can see what i have done wrong.

Search.jpg

Link to comment
Share on other sites

Without actually seeing what you are trying to do, if you have various fields that you want to search a keyword for, you will have to have seperate find requests for each field taht you want.

In other words, take your find key word, "booking" and set it a global field.

Then

Enter Find Mode[]

Set [field1; gKeyword]

New Request

Set [field2; gKeyword]

New Request

Set [field3; gKeyword]

New Request

Set [field4; gKeyword]

I am not sure if this is what you wanted.

Perform Find []

Link to comment
Share on other sites

  • Newbies

Without actually seeing what you are trying to do, if you have various fields that you want to search a keyword for, you will have to have seperate find requests for each field taht you want.

In other words, take your find key word, "booking" and set it a global field.

Then

Enter Find Mode[]

Set [field1; gKeyword]

New Request

Set [field2; gKeyword]

New Request

Set [field3; gKeyword]

New Request

Set [field4; gKeyword]

I am not sure if this is what you wanted.

Perform Find []

I dont know how to do the Set [field1; gKeyword]. I can get it to set the field, however i cant do the end part the ; gKeyword.

Link to comment
Share on other sites

gKeyword is a global text field. If you are using a valie list to select your choice, you can have it used on this global field.

If you are using some other means for the user to select their choice such as a button etc, then just set the glocal field to the value before entering find mode.

Link to comment
Share on other sites

There are two basic finds in FileMaker.

An "AND" and an "OR". an AND limits the found set to those records that meet ALL of the criteria you have entered on your Request. An OR will include all records meeting all of the Criteria any of the Requests. So, in a sense, your OR find can have one or more AND criteria in them.

To preform an "AND" find, you would enter all of the criteria on one form.

i.e.

enter find mode

Set Field (FieldA; "XYZ")

Set Field (FieldB' "ABC")

perform find

this would find ONLY records having XYZ in FieldA [color:red] and , ABC in FieldB.

To preform an "OR" find, you need to have a separate request for each variable. In other words, I want records with this in them, or I want records with that in them.

enter find mode

Set Field (FieldA: "XYZ)

New Record Request

Set Field (FieldB; 'ABC)

this will find all records with either XYZ in FieldA, OR with ABC in field B.

To work this into your own find script, just remember what you are want in your found set.

HTH

Lee

Edited by Guest
Link to comment
Share on other sites

Hi Lee:

Thanks for the response and script suggestions.

Is there a script command to get user input and then continue to the next Set Field? I.E.

Set Field(lName:get(userinput)

New Record Request

Set Field(lName:get(userinput)

Where New Record request is a variable number (I guess a loop) Then perform the find?

Additionally, I often have a need to look for several contacts OR companies or several contacts AND several companies in the same search, so my OR searches are usually pretty simple

Find

LastName = a

OR

LastName = b

OR

LastName = c

Sometimes

LastName = a

OR

LastName = b

OR

LastName = c

AND

CompanyName = A

OR

CompanyName = B

OR

CompanyName = c

So my search is not

LastName = a

AND Company = A

Can this be accomplished in a script requiring user input? I feel this would be a lot easier then having to teach all users the nuances of AND and OR searches and their combinations.

Thanks for your input.

Al

Link to comment
Share on other sites

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