Jump to content
The ORIGINAL FileMaker Community - Forum - Online Business Apps & Software Forum
jdominguez

perform find with a variable

Recommended Posts

jdominguez

Hello, i would like to perform find with a variable but in criteria area i can´t use variable to make this, i probe local variable ($) and global ($$), and goblal records too, i don´t want to use find mode in my script, what can i do?

Share this post


Link to post
Share on other sites
AHunter3

I did not follow all of that, but you can use a variable in a Find in a script.

 

 

This works:

 

Enter Find Mode []

Set Field [YourTable::TheField, $Variable]

Perform Find []

 

 

This does NOT work:

 

Perform Find [restore requests: YourTable::Field = $variable]

Share this post


Link to post
Share on other sites
jdominguez

it works!!!!,

 

 

thank you very much AHunter3

Share this post


Link to post
Share on other sites
Newuser1010

what does restore the request do exactly?

Share this post


Link to post
Share on other sites
AHunter3
what does restore the request do exactly?

 

Let's say you want to do a find for all records in YourTable where FieldX = "foo".

 

 

 

You could do this:

 

 

Enter Find Mode []

Set Field [YourTable::FieldX; "foo"]

Perform Find []

 

 

Or you could do this:

 

 

Enter Find Mode [restore requests: FieldX = "foo"]

Perform Find []

 

 

Or you could do this:

 

 

Perform Find [restore requests: Field X = "foo"]

 

 

 

Looks like the bottom way is nicest, using the fewest script steps, doesn't it? Nope! The first way is the way to go. It's easier to tell what the heck your script is actually doing when you open it to look at it. In the "Manage Scripts" dialog for editing the script, the second and third versions have their options hidden away so you just see this:

 

 

 

Enter Find Mode [restore]

Perform Find []

 

or

 

Perform Find [restore]

 

 

 

Secondly, the first format makes it easier to EDIT your find requests. It's not an issue so much with simple requests like FieldX = "foo" but If you wanted to find all records where FieldX is "foo" and also all records where FieldX is "bar" but omit any records where Field Y is "cancelled", and then later you realize you need to include records where FieldX is "bat", it's easy to add a New Request script step using the first nomenclature, whereas to insert a clause in the Restore Requests dialog anywhere other than at the bottom is a pain in the butt. You have to delete the requests at the bottom, enter the new one, then add back in the ones you deleted.

 

And until recently, as the original posts in this thread reveal, you could not use a $variable as a parameter of your requests except by using the first nomenclature. (I think they may have finally fixed that in version 11?)

 

 

 

HISTORY LESSON

 

 

Under FileMaker Pro version 2, there was no Set Field script command; no Insert Calculated Result, even; we were limited to "Paste Literal". It was still at least easier to debug than Perform Find [restore] because you could not tell AT ALL what parameters were buried away in a Perform Find script step that restored requests. Besides, to "restore requests" you had to first actually manually perform the find and then go create (or edit) your FIND script in order to embed the parameters that were to be "restored".

 

Starting with FileMaker Pro 3, we were given Set Field and you still could not determine what the heck was being restored in any of those "restore" variants, so the combination of flexibility of what you could do with Set Field and clumsiness with the "restore" commands made most of us decide never to use "restore requests".

 

They're a bit more user-friendly nowadays (you can at least drill down and see what they are doing, and you can edit what is being restored from within the script itself at least). But really, it's still klunky. I advise using the first nomenclature and just avoid using the "restore" options. But do you see how they work, now?

Share this post


Link to post
Share on other sites
This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.




×
×
  • Create New...

Important Information

Terms of Use