Jump to content

Scripting a find with an omit


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

Recommended Posts

I need to make a Find script that allows the user to enter 1 item "Widgets" then is returned all widgets that are not discontinued. If there are no items found, the script displays the widgets that are discontinued. I am trying to avoid having users have to sort through discontinued items every time they do a find, but still be able to find the discontinued items if needed.

I tried the following, but I just can't get it to display what I want. Can anyone help?

# "omits records with "Discontinued" in Product Status field"

Enter Find Mode [ Request 1 (Omit): Productstatus Discontinued ]

[ Restore find requests ]

# "User enters find criteria"

Enter Find Mode

[ Pause ]

Perform Find

[ Constrain Found Set ]

Pause/Resume Script [ ]

If [ Status(CurrentFoundCount) > 0 ]

Else

If [ Status(CurrentFoundCount)=0 ]

# "None are found, then we need to include the discontinued items without pause."

# "Here we need to find on the user's criteria again without omitting the discontinued items."

Modify Last Find

If [ Status(CurrentFoundCount)=0 ]

Show Message [ Buttons: "OK", "", ""; Data: "No records match this request." ]

End If

End If

End If

Go to Layout [ original layout ]

Sort [ Sort Order: Manufacturer (Ascending)Model (Ascending) ]

[ Restore sort order, No dialog ]

Link to comment
Share on other sites

You don't need to Enter Find Mode twice. Don't use Restore on the Enter Find Mode step; add a step after the user enters criteria to create a new request, set the Product Status field, and omit. Don't Pause/Resume after the Perform Find step, as there's no need for it. Delete the omitted request after modifying the last find. In summary,

Allow User Abort [Off]

Set Error Capture [On]

# "User enters find criteria"

Enter Find Mode [Pause]

# "omits records with "Discontinued" in Product Status field"

New Record/Request

Set Field [Product Status, "Discontinued"]

Omit Record

Perform Find [Constrain Found Set]

If [not Status(CurrentFoundCount)]

# "None are found, then we need to include the discontinued items without pause."

# "Here we need to find on the user's criteria again without omitting the discontinued items."

Modify Last Find

Go to Record/Request/Page [Last]

Delete Record/Request [No dialog]

Perform Find [Constrain Found Set]

If [not Status(CurrentFoundCount)]

Show Message ["No records match this request."]

Show All Records

End If

End If

Go to Layout [ original layout ]

#Don't sort if no matching records were found, i.e. all records were shown

If [status(CurrentFoundCount) <> Status(CurrentRecordCount)]

Sort [sort Order: Manufacturer (Ascending)Model (Ascending)] [Restore sort order, No dialog]

End If

Link to comment
Share on other sites

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