Welcome to one of the most basic differences between the two systems. In FileMaker you have built in support for "ad hoc" user searches of your database that require zero programming effort on your part. They can simply enter find mode, specify some criteria and perform the find. The Found Set will then update to just the records matching their specified criteria. And we developers need not do a thing to make that happen.
But if you want a script supported find where the user is asked for specific information and then the script performs the find, this can also be done. It can be a great way to make finds less confusing to the user.
First, see the scripted find examples in this thread: Scripted Find Examples
In these examples, users enter search criteria into one or more global fields while in Browse mode and then the script enters find mode, sets up the needed search criteria in one or more find requests and performs the find.
You then have multiple options for how to "ask" the user for this criteria.
Show Custom Dialog can include up to three input fields--which can be up to three global fields to use with such a find script.
New Window can open a new window with a different FileMaker Layout where you have placed these global fields. This takes more scripting, but because you are using a FileMaker layout, you can use value lists, conditional formatting, etc to make things more user friendly.
You can place such fields in the header of your existing layout.
You can add a search button that just changes layouts to go to such a "search layout" and your script can change back as part of the find script
FileMaker 13 developers can place these fields inside a Popover on the original layout.
Please could you explain-- In the script example I am stuck on this line If [Not Get ( FoundCount )//no records found ]
This is a script step added by double clicking IF on the list of steps on the left hand side of the script editor. The text inside the brackets is a Boolean expression. That is, it's an expression that must evaluate to either True or False. in calculations like this any result other than 0 or null will evaluate as True while zero or null results evaluate as False.
get ( FoundCount ) is a version of the get function that returns the number of records in your found set produced when the find is performed. In a sense it would be like using a function to get the number of records in a query's recordset object in MS Access.
The Not operator reverses the logic, so any number result greater than zero from Get ( FoundCount ) becomes False and if the function returns zero, that becomes True. So if the scripted find fails to find any records matching the specified criteria, this expression evaluates as true and the steps enclosed in this If block will then execute.
// is a comment operator so anything to the right of // in a calculation is ignored when the calculation evaluates.
I get this now thank you but I couldn't find the NOT operator so I guess you just type that.
I am now struggling with the global storage part - if I change the field type to global are the week numbers end up the same and so I made a new table and made yet more fields, making them global and used the relationship screens to make global:week number = pot book tble:week number . I don't think this is right ?? see screenshot Thanks H
You use global storage only for setting up fields that the user uses for entering their search criteria. You do not change your existing fields to global. The global fields are the closest we can come to the "unbound text box" we might use on an MS Access form.
Put a global and a nonglobal field on a layout. Enter data into both. Enter Find Mode. Which field still shows data in the field while in Find Mode?
That's where you use your global fields--to hold data entered by the user that the script will use to create the needed find requests.
I have achieved my aim now thanks to your help Phil
I put the global fields in the footer at the bottom of the potato book layout screen shot 1.
Now the user can filter on week number and customer then hit the red button.
this activates the script and the result is an invoice - 2nd screen shot.
Thanks again Phil - now back to the spray record problems !