Jump to content

my first find script


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

Recommended Posts

Hello

I'm trying to write my first script and have gotten confused with all the literature.

Basically I'm within the one file that I want to do the find on.

So:-

1/ I put a date into a field. Then press a button.

2/ Based on that it returns all matching fields and then takes me to a preview of the report ready for printing.

One tricky bit is that I want to enter the date once and have it look at two date fields per record. Only one of these fields in each record will have the date in it. In other words it's an "OR" find. Look at date field A and if it matches return the record, then if not look at date field B and if it matches return the record.

I hope that's not too confusing and thanks anyone for their help.

This usergroup has already gotten me out of so much trouble. I hope I'll be able to contribute soon.

Best regards

Drew

Link to comment
Share on other sites

Allow User Abort (off)

Set Error Capture (on)

Enter Browse Mode()

Go to Layout (Layout for date entry dialog)

# Create a global date field called "gDate"

Pause/Resume (script)

If (IsEmpty(gDate))

Show Message ("You must enter a date", OK)

Perform Script ("this script")

Exit Script

End If

Enter Find Mode ()

Set Field (Date 1, gDate)

New Record/Request/Page

Set Field (Date 2, g Date)

Perform Find()

If(Status(CurrentError) = 401)

Show Message ("No records were found", OK)

Show All Records

Go to Layout (original layout)

Exit Script

End If

Go to Layout (Report You Want)

# If you don't need to sort, leave this step out

# It is good programming practice to put the sort step in its own script and call it with a Perform Script

Sort (restore)

Print()

Go to Layout (original layout)

-bd

Link to comment
Share on other sites

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