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

Scripting a Find with both a global Date Range and Omit Criteria


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

Recommended Posts

Posted

I want a script that will allow me to produce a specific field criteria within a user defined date range.  I'm getting hung up... any suggestions would be greatly appreciated. Below is a sample of the script:

 

If[isEmpty(TableName::gDateStart)]

Show Custom Dialog ["Start Date must have a value. Please enter"]

Exit Script []

End If

 

If[isEmpty(TableName::gDateEnd)]

Show Custom Dialog ["End Date must have a value. Please enter"]

Exit Script []

 

If[TableName::gDateEnd < TableName::gDateStart)]

Show Custom Dialog ["InvalidEndDate"; "End Date cannot occur before Start Date. Please reenter"]

Exit Script []

End If

Go to Layout [LayoutName]

Enter Find Mode []

Set Field [TableName::DateStart; TableName::gDateStart &"..."&TableName::gDateEnd]

Perform Find

 

All of the above works fine...  Producing the correct results within the specified date range (and warns the enduser if they neglect to enter one of the required dates or they they enter an end date lower then the Start date).

 

But how would I modify this script if I also wanted a specific field criteria to be omitted from my result?  Another words, I want to omit the records where TableName::ParticipantStatus = "Child" (AND all of the records should still fall within the user identified date range).

 

Any help would be greatly appreciated.  Thank you.  

 

 

Posted

IAnother words, I want to omit the records where TableName::ParticipantStatus = "Child" (AND all of the records should still fall within the user identified date range).

It would look like this:

 

Enter Find Mode [ pause for user ] ... user or first specificied of date range or whatever

New Record/Request

Set Field [ TableName::ParticipantStatus ; "Child" ]

Omit Record

Perform Find [  ]

Posted

By the way, most Users like the ability to leave start date empty (meaning include all dates prior to end date) or leave end date empty (meaning all dates greater than or equal to start date). And surprisingly this is a valid range search. ...31/12/2004 or even 1/1/2012...

FM - if no value on the left of the ellipses - assumes all prior values and reverse for the other side. So if this business rule is acceptable then you can skip the tests for empty globals or if large data sets you might want to warn if BOTH were empty such as Count ( gStartDate ; gEndDate ) = 2 // means both lack dates.

But the one-sided range search tickles me. It feels elegant and efficient (if that is what you want anyway). If you have end number which might ever be decimal be sure to use 3 ellipses though or FM will misinterpret and see 2 ellipses with decimal as 3 ellipses with whole number.

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