Jump to content
Sign in to follow this  
elvis_impersonating_penguin

Find within Current found set

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 ]

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

so, basically what you are saying is, i have to deal with it. Well thats what i thought the answer was. Unfortunatly thats not the answer my boss wants to hear. But, oh well, maybe i will be able to figure out some great work-around for it. hey, it could happen smile.gif" border="0

Share this post


Link to post
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 ]


Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.