Jump to content

searching a date range and a second field


gary29422
 Share

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

Recommended Posts

I use two global fields to find a date range of records.  I then use these two global fields to print the date range in the report's header.

 

Here is the script that I'm using:

 

Enter Find Mode [ ]

Set Field [ sales::datefield; global::gDateStart&"..."&global::;gDateEnd ]

Perform Find [ ]

 

How can I modify this script so I can include a second search criteria?  I need to select records within a specific date range that also have this criteria:   sales::keyfield="X"

 

Thanks

Link to comment
Share on other sites

Enter Find Mode [ ]

Set Field [ sales::datefield; global::gDateStart&"..."&global::;gDateEnd ]

Set Field [sales::key field; "X"]

Perform Find [ ]

Link to comment
Share on other sites

And for displaying in your report header, you can just use a merge field as:

 

<<global::gDateStart>> - <<global::;gDateEnd>> for <<sales::key field>>

 

... put it all in the same single merge block.  Of course if you want the User to then be able to modify the report title, you would need to use the actual fields instead.  But merge is nice because it slides nicely, allows spaces and text easily between, and doesn't allow modification.

Link to comment
Share on other sites

It should work fine, regardless your FM version.  You didn't actually put "X" did you?  You would put your key field value there.  Add a pause script step immediately after you set the key field and look at the values entered in the three fields.  Then make sure you have data to match.  Once you get that straightened out, it is also good to include error trapping in your script so you don't get the dreaded "no records found" and instead you provide your user with your own message or handle it however you wish.

 

If still stuck, you can zip and attach your file - it can be an empty clone.  Also be sure that you do not have restore on that Perform Find (or Enter Find) which can throw your results.

 

ADDED:  Are you still on version 9?  If not, please update your profile.  And if possible, get FMP Advanced so you can use debugger to see what is going on.  :-)

Link to comment
Share on other sites

This topic is 2601 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
 Share

×
×
  • Create New...

Important Information

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