Jump to content

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

Recommended Posts

  • Newbies
Posted

I am working on a script to find all call back dates after 01/01/2009 and todays date

Here is the script

Enter Browse Mode

Show all records

Enter find mode

Go to field (People::Call Contact)

Insert Calculated results [

People::Call Contact=(Date ( 01 ; 01 ; 2009)..Date ( 12; 31 ; 2009 ) )

What do I have to use here?

Posted

The Enter Browse Mode and Show All Records aren't necessary before a find. I would also suggest you use a global date field (or two) to hold your dates instead of hard-coding them within your script. It is also highly recommended that you use Set Field[] instead of Insert Calculated Result[] ... Set Field[] is always the better choice because it doesn't require the field be on the layout. Set Field[] also doesn't require that you Go To Field.

So globals gFrom and gTo are on a layout for User to enter their information then button runs following script:

If [ not ( gFrom ) or not ( gTo ) ]

Show Custom Dialog [ OK ; "One of your date range fields are empty. Try again." ]

Halt Script

End If

Go to Layout [ layout based upon People table ]

Enter Find Mode [ uncheck pause ]

Set Field [ People::Call Contact ; gFrom & ".." & gTo ]

Set Error Capture [ On ]

Perform Find [ ]

If [ not Get ( FoundCount ) ]

Show Custom Dialog [ OK ; "No records found." ]

Go to Layout [ Original Layout ]

Exit Script

Else

... do whatever you wish with your found set of People

End If

:smile2:

Posted

You don't need to Show all records, the Find will search all records anyway.

You should read about the Finding ranges of information which can be found in the User Guide, and the Online Help when FileMaker is open also here Link

Note the Equal to and Greater Than

Lee

  • 3 months later...
Posted

I can't believe I was so sloppy in this first line of script ...

If [ not ( gFrom ) or not ( gTo ) ]

Why I put parentheses around the fields is beyond me; I must have been quite tired. The step should only be:

If [ not gFrom or not gTo ]

I dislike the fact that someone new might read this and perpetuate inefficient or junkie process and I apologize for my error. Please do not use needless quotes. :crazy2:

Posted

I'd have done that a bit differently, made the purpose more explicit...

If [ isempty( gFrom ) or isempty( gTo ) ]

...but I'm funny that way.

Posted (edited)

Hi Vaughan, I believe we should pass on using true Boolean logic whenever we can. It is more efficient and truly, Boolean is understood in all programming languages. If someone understands Boolean then my example is just as explicit and easy to understand.

If those in FileMaker don't understand it then they need to learn. :wink2:

Edited by Guest

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