Jump to content

Saving and Recalling Found Sets

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

Recommended Posts

I have a situation where I need to perform a find in a script, but in case the user was already working from a found set I would like to return to that set when my script is done.

I can't find any functions that would do this, andy ideas?



Link to comment
Share on other sites

You could compare the total number of records to to the size of the current found count. If the found count is smaller than the total database, then they are working from a found set.

If so, then you need to loop through the found set and set a Flag field to 1. Perform your find and necessary functions. When completed, do another search for Flag=1. This will bring back their original found set. Then reset all of the records' flag fields to 0 or empty.

If the found set and the whole database were originally the same size -- that is, there was no found set -- then skip the flagging routine as it can be time consuming.



Link to comment
Share on other sites

As you are listed as using 7, you could open a new window and do your new find in there.

Then the user can do another find and work in that found set. At any time they can close the window and they have their original found set.

Link to comment
Share on other sites

Ouch, those both sound like ugly solutions (no offense, it's FMs fault).

Opening a new window is good in one way because if multiple users are performing this script they won't mess with each other, but the script is run on a field change and it'd be weird to pop-up a window when a field changes.

Dan's method is nice because it's transparent, but it seems like there could be trouble with multiple users. Maybe I could do something with repetitions, placing each users flags into a different repetition number.

Link to comment
Share on other sites

LOL Dan -

It is hard to keep switching from one mindset to the other.

Just this morning I needed to show two portals in FMPro v6. 1 for groups subscribed to, 1 for groups not subscribed to.

In both versions showing the subscribed to gorups is easy.

The not subscribed to is the kicker. In v7 all I need is an Id not equal to ID to generate the match set. Go figure the routes I have to take in v6 to make this work.

As to opening new windows being ugly, not necessarily. You can script the opening, size and placement of windows so you can really make it cook.

I love the idea of being able to have multiple found sets of data open at once.

And as an FYI for those reading this post who are in the Central Florida area this month. Come along to register to win a FREE copy of Developer 7. Yep that is right. We are giving a free copy of Developer 7 away (That's a $500 prize). Check this post in the User Group forum for details.


Link to comment
Share on other sites

Andy- I'm working on the new window method now, but I'm having trouble doing the find.

My script goes like this:

New Window[]


Relookup Field Contents[...]

My one find criteria is Invoices::InvoiceID = InvoiceID but i get no results from that find.

What am I doing wrong here? I just want to find the current record.

Link to comment
Share on other sites

You can't restore variables (only constants can be restored with the Perform Find [Restore]). You could restore the Status="Whatever" part of a find, but the variable InvoiceID should be set while in find mode using Set Field.

From an Invoice layout:

Set Field [ Invoice::gInvoiceID , Invoice::InvoiceID ] //Set a global as the real InvoiceID won't be available in Find Mode

New Window []

Go to Layout [ Line Items ] //Sets the context of the find

Enter Find Mode [] //Put a restore here if needed for Status="Whatever"

Set Field [ Invoice::InvoiceID ; Invoice::gInvoiceID ]

Set Error Capture [On]

Perform Find []

If [ Get(FoundCount) = 0 ]

#Error handling

End If


I still think this would be easier with a Go To Related Records script step.

Link to comment
Share on other sites

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