Jump to content

Make find based on current record


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

Recommended Posts

I'm trying to do some calculations and the way I figure, I want to make a new find request using some of the data in the current record. But maybe I'm going about the whole thing the wrong way -- I'll outline exactly what I'm trying to do.

In my database, people enter a System and Subsystem and number -- where the number should be one more than the current count of the records in the database with that same System and Subsystem. Right now people have to manually count (or manually do a find) to figure out how many matching records already exist.

The only way I figure this can be done is by making a new find request, using what the user has entered so far into the System and Subsystem fields as a basis, then using Get(FoundCount). Then I can use the "Set Field" step using the result.

I can't figure out how to make Find request properly. I tried to store a find request in the script, using the value "table::System" in the request, but that just makes a request using the text "table::System", not the user-entered values.

How do I do this? Or is there another way to do what I want?

Link to comment
Share on other sites

OK, I figured out a way to do it (mostly). My problem was trying to store the find request in the script.

First I defined some global fields (using the "Storage" tab in the field options) for System and SubSystem and Number. I store the user-entered values in those fields then perform a find by building the find request at run time.

My script is mainly:

Set Field [table::global_System; table::System]

Set Field [table::global_SubSystem; table::SubSystem]

New Window[Name: "temporary find"]

Select Window[Name: "temporary find"]

Enter Find Mode[]

Set Field [table::System; table::global_System]

Set Field [table::SubSystem; table::global_SubSystem]

Perform Find[]

Set Field [table::global_Number; Get(FoundCount)]

Close Window [Name: "temporary find"]

Set Field [table::Number; table::global_Number + 1]

Link to comment
Share on other sites

This topic is 5777 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
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.