Jump to content

Simple Find Scipt

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

Recommended Posts

Newbie alert!

I want to write a script to perform a find that inserts a word into a field that someone has already entered into a different field.


User has entered into a field called Subject "Food"

User presses find button and it enters the word "Food" into a field called "category" and he can then enter other options into his search

Hope that makes sense. Thanks

Link to comment
Share on other sites

This area is a little confusing. There are a few possible solutions. But first, why are they entering "Food" in Subject, apparently in Browse mode, then you are taking them into Find mode and entering "Food" into Category? It seems the 2 fields are overlapping; perhaps one is redundant.

Anyway, since you're having them enter "Food" in Browse mode, it should be a Global field, type text. Globals are much like "variables" in other languages. (Perhaps this is why you had 2 fields, because you didn't know about globals?) There is only 1 value in a global for the entire file, all records (also no records; also, there can be many values in a global with repeats, one in each, but they're still the same for all records).

You can have the user enter a value into a global in Browse mode, then switch to Find mode and set a regular field (or fields) to the global, then Perform Find. (Unfortunately, globals in a Header cannot be entered in List View, which limits their usefulness. You can use the Custom Dialog for this, though it's a bit primitive still with regard to Value Lists, etc..)

You can set other values from the current record into globals also, to be passed to the Find script, if that is needed.

If you want, you can recreate all the relevant data fields as globals, allowing the user to select all their criteria in Browse mode; which is generally safer than Find mode, since they can in no way mess up regular data this way.

It is much more difficult however, to simulate all the features of a real Find, especially multiple requests, omits, etc.; but it works great for simple Finds where data integrity is a primary concern.

Link to comment
Share on other sites

Wow that is a confusing reply Fenton!!!

Perhaps I should explain myself better.

At the moment I have for example 10 different databases all working in the same way and I want to merge them into one. Each database is a seperate subject ie food, hospitality, manufacturing etc

I want to create a log in for the database where by at the start of each session I would enter food, and then to save me typing food into my find each time it would insert the word food automatically from when I logged in.

Link to comment
Share on other sites

There a several ways you can use global fields and Finds together, so it's hard to say "this is the best way." I cannot know exactly what you need, because I don't know your files. From what you say above, you have an unusual, but not rare, situation of wanting to search more than 1 file for the same criteria. That is not a big problem, if you use globals and simple scripted finds. Presenting the results in one interface is the more difficult task.

If you want a value to persist for one user per one session, then it should go into a global field. If you want it to work in Finds in different files, then you have to pass it to the other files.

Link to comment
Share on other sites

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