Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Validation where variable represents the date 1

Status
Not open for further replies.

PelicanProductions

Technical User
Mar 15, 2007
3
US
Hello, I am building a subscription database for a quarterly publication and need to be able to identify records for expiring subscribers. The database contains a field for ending issue but the issue is identified by season and year ie. "Summer 2007". How can I specify that "Summer 2007" equals a specific date or date range without renaming the values in the field? I am trying to create a script that will identify only expiring records. Please help if you can, I am a graphic artist & web designer by trade and this database stuff is new to me.
 
Well, first you'll have to decide what your universe of text-based dates are, and when your seasons start and end, but after that it's not that tough.

Let's say, for example, you want to identify all your entries marked as "Summer 2007" with an ending date of August 31, 2007. First, make sure you've created a new field with a Date data type to hold the resolved date, then create a script that does this:

Show All Records
Go to Record/Request/Page [First]
Loop
Set Field [date_field; Case( text_based_date_field = "Summer 2007", "8/31/2007"; text_based_date_field = "Spring 2007", "6/30/2007"; text_based_date_field = "Fall 2007", "10/31/2007")
Go to Record/Request/Page [Next, Exit After Last]
End Loop

---------------

BTW, I never string my case functions together on one line (they're harder to read that way, I just did it so that the calc looks the way it should look in your Scriptmaker ... the unmashed version should look like this:

Case(

text_based_date_field = "Summer 2007", "8/31/2007";
text_based_date_field = "Spring 2007", "6/30/2007";
text_based_date_field = "Fall 2007", "10/31/2007"

)

 
Thanks CryoGen, works great.

One more question, now that I have converted my text_based_date_field to dates how do I get Filemaker to compare the last issue date to the current date and display expired records?
 
It depends on where you store your last issue date. Assuming that last issue date value in the same row in a different field, you could write a calculation field that resolves that as well.

Create a calc field with a text data type, then use an IF statement to do the comparison:

If ( new_date_field >= last_issue_date, "Expired", "Current")

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top