Jump to content

Searching between dates


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

Recommended Posts

Toni:

Welcome to the Forums.

To search for a range of dates, the method is (in find mode, obviously)??? "2/2/2003...7/25/2003". The "..." is what you're after.

-Stanley

Link to comment
Share on other sites

Hi,

You will need to create 2 fields for this. I use g_StartDate adn g_EndDate. To be able to enter a range within a script the dates must first be turned into text. The user will enter the Start date and the End date into the fields.

In your script to enter the dates for a range find you will need to use a caclulated result. The calc will be.

DateToText(g_StartDate) & "..." & DateToText(g_EndDate )

This will combine the start and end date which can be used in your script.

You can use the SetField step or the Insert calulated result right before your perform find step which will be the Calculation above.

HTH

Michael

Link to comment
Share on other sites

Hi,

i am trying to do the exact same thing (and am also new to this).

i have a DateofBirth field, and am trying to display a list of records which fall between two dates. I have set up DOB1 abd DOB2 for the range, and then have a script with:

Set Field ["DateofBirth", "DatetoText[DOB1]&"..."&DatetoText[DOB2]"]

Thing is, I dunno what to do next to display this data set!! What else needs to go into this script??

Any help appreciated!!!

Link to comment
Share on other sites

Actually, you can't use a Set Field in this instance, since you're setting a date field with a text result. You'll need to use Insert Calculated Result.

If your users are entering the values for DOB1 and DOB2, then

Set Error Capture [On]

Insert Calculated Result [DateofBirth, DateToText(DOB1) & "..." & DateToText(DOB2)]

Perform Find [ ]

If [not Status(CurrentFoundCount)]

Show Message ["No records for the specified date range exist."

Show All Records

End If

If users are not setting the DOB fields, then deselect the Pause option when entering find mode.

Link to comment
Share on other sites

Thanx for the reply,

tried as you suggested, and am finding the only record in DateofBirth field which has a no data (actually has a '?' in it). What am I doing wring here?

You said i would need to use Insert Calculated Result. Duh, where?

(Sorry if these are really dumb questions, but I am trying to get around the basics of FM).

Link to comment
Share on other sites

Sorry, Queue, Insert Calculated Result is there obviously.

I have tried as you have suggested here, and the script inserts '...' in the DateofBirth field, and then the Find button appears on the left of screen area.

Any clues.

Thanks, Hugh

Link to comment
Share on other sites

Argh. Some of my code seems to have vanished.

After setting error capture, enter Find Mode [Pause] (no pause necessary if there's no user intervention). DOB1 and DOB2 should be global fields. If there is no user interaction, set the globals with the result of their calculations, if applicable, in Browse Mode, then enter Find Mode and run the Insert Calculated Result step.

Sorry for the confusion.

Link to comment
Share on other sites

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