Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

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?

Thanks

J

Posted

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.

HTH,

Dan

Posted

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.

Posted

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.

Posted

This is where the Copy All Records/Paste into global technique comes in handy. See here for an example.

Posted

My solution is much uglier. Go with Andy's. I've got to get into the FM 7 way of looking at the world. I keep forgetting the brave new world we're in.

Posted

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.

http://www.fmforums.com/threads/showflat.php/Cat/0/Number/108902/page/0/view/collapsed/sb/5/o/all/fpart/1

Posted

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[]

PerformFind[Restore]

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.

Posted

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.

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