Jump to content
Server Maintenance This Week. ×

Find within Current found set


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

Recommended Posts

ok, i am pretty sure everyone has tried to do this at some point or another. Well i created a script that will do it, and it works great. Only problem is, if you do it with a large number of records (and it would be pretty pointless to do if you didn't have a large number of records) it eats up 90% of the CPU's processing power, and also takes a couple minutes to run. So it is really going to slow down my database when someone runs the script. And if more than one person runs the script, well i dont even want to think about that scenario. well anyway here's my script.

code:


Set Field [ gContactIDNums, Contacts for related activities::gContact ID Number ]

Go to Layout [ Find ]

Enter Find Mode

[ Pause ]

Set Field [ Contact ID Number, LeftWords(gContactIDNums, 1) ]

Set Field [ gContactIDNums, RightWords(gContactIDNums, WordCount(gContactIDNums) - 1) ]

Loop

Exit Loop If [ WordCount(gContactIDNums) = 0 ]

Duplicate Record/Request

Set Field [ Contact ID Number, LeftWords(gContactIDNums, 1) ]

Set Field [ gContactIDNums, RightWords(gContactIDNums, WordCount(gContactIDNums) - 1) ]

End Loop

Perform Find

Refresh Window

[ Bring to front ]


what the first step in the script does is put all the IDnums of the records in the current found set into the global field, gContactIDNums. I won't bore you with how that is done because thats not my problem. What i would like to know is, is there a way to do something similar without taking up 90% of the CPU's processing power..

[ August 28, 2001: Message edited by: bman ]

[ August 28, 2001: Message edited by: bman ]

Link to comment
Share on other sites

Why not just have a flag field that you clear before the intial find and then set it to "yes" in all the found records after the first find. Then when you do the second find, pause the script in find mode to let the user enter the criteria. Then, Use a set field command to set the flag field to "yes" before continuing with the find. Like this,

code:


Replace[FlagField, calculation, "yes"]

Show omitted

Replace[FlagField, calculation, ""]

Enter Find mode

Pause Script

# User enters find sub-criteria and clicks continue

Go to Record/Request/Page [first]

# Add the "yes" criteria to the FlagField in all the requests

# Remember, we are still in Find mode.

Loop

Set field [FlagField, "yes"]

Go to Record/Request/Page [next, exit after last]

Perform Find


[ August 28, 2001: Message edited by: BobWeaver ]

1124858314-Copy_and_Paste.zip

Link to comment
Share on other sites

I think the trick is to understand what you are asking for. A "find within a find" is usually a boolean "and" search, where two or more fields are searched upon simultaneously.

Example: in a contact database we might perform a search for "USA" in the country field, but find it's found too many. We might want to then refine the search by adding the criteria "surname begins with B". To do this the new search needs to have the country field with "USA" and the surname field with "b" simultanelously.

Probably the easiest method to do this is to use the Modify Last Find script step: after searching for "USA" they run the script that performs the Modify Last Find step. This brings up the layout with the last request already entered: the users need to know that they leave "USA" in the country field and just add "b" into the surname field to refine the search.

What I am trying to say here is that what you are asking for *can* be done, but it's as much a "user" problem as an FMP scripting problem since users must understand how AND searches work.

I personally think it's far easier, more reliable and rubust to teach the users how to search properly than to create a complicated script system that tries to work around the issue. In particular, any system that replaces field values for a found set will eventually cause problems in a multi-user environment due to record locking from other users. It'll also be painfully slow.

--

Regarding FMP eating up 90% of the cpu processing power -- well I'd be pissed off it it *didn't* use that much. In fact I'd like to know how to get it to use 100% while it's working: that'd be an instant 10% increase in performance!

It's a bit like having a powerful car and complaining about the amount of fuel it uses...

[ August 28, 2001: Message edited by: Vaughan ]

1124874207-Copy_and_Paste.zip

Link to comment
Share on other sites

thank you thank you thank you Vaughn... as you answered my query of nearly the same title in another subject listing that I just posted... very weird though, as I found this reply of yours and thought it was the quickest reply to one of my posts ever and couldn't figure out what was going on for a minute when I read it... LOL

Link to comment
Share on other sites

RE: What i would like to know is, is there a way to do something similar without taking up 90% of the CPU's processing power..

That is FileMaker. You cannot do much about it. IMHO - port from Macintosh with all functionality, but a bit demanding on CPU.

With server serving more users, only user will see this.

Just to add small bit: the best for testing cooling on processor is not FM, but Windows version of GoLive 5 from Adobe. Also port from Mac. That makes processor really hot, while with FM it stays cool.

Link to comment
Share on other sites

well, the modify last find script step, isn't going to work for me. I guess i will need to explain a little more. I am not actually narrowing a "Found set" what i am doing is using a script to go the all the records in my activities database related to the current found set in my contacts databases. the powers that be decided that they wanted a way to do a find on just the related records. so i tried using that script.

here is the script that goes to the related records

code:


Perform Script [ "User Cancels" ]

[ Sub-scripts ]

Freeze Window

Go to Layout [ Contact IDs ]

Copy All Records

Go to Layout [ Found Contacts ]

Paste [ gContact ID Number ]

[ Select entire contents ]

Go to Layout [ Data Entry ]

Go to Related Record [ Contacts Find Activities ]

[ Show only related records ]


Link to comment
Share on other sites

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