Jump to content

Constrain after search using trigger


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

Recommended Posts

Hi, I need to constrain the found set after the user has performed a find, depending on the value of a global. Let´s say for instance that I have a database of cities, and before entering into find mode, the user enters "NY" the global. If the user afterwards goes to find mode, I would need the user to be able do a search with whatever criteria they want, perform the find, and afterwards (using a script trigger), constrain the found set to show only the cities belonging to the state of NY (as entered in global).

The problem I have now is that I have created the constrain find script (to the value of the global), but if I choose to trigger it as "On Mode Enter [browse]" it goes into an infinite loop. Is there any way to avoid this? Thanks very much in advance!

Link to comment
Share on other sites

If you script the enter to Find mode, you can simply set the City field to the value of the global "for them."

Thank for for the reply, I thought of that too but the problem is, for instance, if the user makes a "new request" in find mode. Then the City field is set to the global only to the first request. So I need a way to constrain the found set after the search has been performed.

Link to comment
Share on other sites

if the user makes a "new request" in find mode. Then the City field is set to the global only to the first request.

You could trigger the script OnRecordLoad, enabled in Find mode only.

As an aside, I am puzzled why some of the criteria are entered into globals in Browse mode and the rest directly in Find mode. It doesn't seem like a consistent user interface.

Link to comment
Share on other sites

You could trigger the script OnRecordLoad, enabled in Find mode only.

As an aside, I am puzzled why some of the criteria are entered into globals in Browse mode and the rest directly in Find mode. It doesn't seem like a consistent user interface.

Thank you for your reply comment, here is the reason why:

Let´s say the global is formatted as a checkbox containing all US states. This global in on the header of a list layout. The user wants to check only those states the searches are relevant for, so the result is automatically filtered, and applies to the following searches.

For instance, if "NY", "CA" and "MA" are checked, the user wants that, after having performed a search for cities with "population > 100,000", only cities with more than 100,000 habitants belonging to either NY, CA or MA show as result. If you have a better way to do this please advise, thanks!

Link to comment
Share on other sites

If you have a better way to do this please advise

It's hard to say. Usually, if users are sophisticated enough to enter Find mode, create new requests, etc. all by themselves, then no script-assisted measures are required. If they are less proficient, then everything is scripted for them. You seem to describe a hybrid sort of situation.

Link to comment
Share on other sites

Here's where I typically say, don't try to predict every Find request and script it.

However, if that's all you need (limit any Find to a chosen set of cities), I'd probably design it using a filtered portal. So, they Find. I capture all recIDs in the found set and store in a gMK. This multikey is the parent key to the portal of "found" recs. Then, filter that portal using the City multikey.

I'm sure if you solve this, they'll think of another combo. You're best teaching them to Find.

Link to comment
Share on other sites

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