PDA

View Full Version : Retrieving field data from another file to the cur


ABC123

lgoode
02-09-2004, 08:14 AM
I have a form over the parent of a set that optionally needs to obtain two fields from one of two different master files (not in the set) and put the fields into the parent form and database. The parent form has a selection button for each master form. Each master file has a special selection form for this purpose. I have created two global variables to contain the two fields that are the same format and length in either master and the parent form. When I execute either choice I get the correct master and can select the proper record but nothing in the varibles or back to the parent form. Any suggestions?

Jim Chapman
02-09-2004, 08:41 AM
Hello Lloyd,

""When I execute either choice I get the correct master and can select the proper record but nothing in the varibles or back to the parent form. Any suggestions? ""

It sounds like you have the structures in place, but you will have to explicitly tell Alpha to put the, in your words, "Master table" field value in the variable, then explicitly tell Alpha to put the value of the variable in the specific parentform field.

Jim

Jim Chapman
02-09-2004, 08:42 AM
That wasn't very good was it...... sorry, hit the send button before thinking.

Check out the Action Scripting commands for setting variable values, and setting field values. This will allow you to explicitly perform the actions I mentioned above.

Jim

lgoode
02-09-2004, 09:46 AM
Thanks for the speedy reply: Here are the Action Scripts I used:
Going out to the master from the parent form I execute the following:
1. DIM to define the variables – to insure that the variables are available
2. Get Field Values (into Variables) – to load the parent form values
3. Open Form or Browse Layout – Opens the proper form to the selected Master file
4. Set Field Values – sets one parent form value upon return
5. Set Field Values - sets other parent form value upon return

In the master there is a select button that
1. Set variable to constant or expression result – sets one variable to the selected record field value
2. Set variable to constant or expression result - sets other variable to the selected record field value
Exiting this form only closes the form

In the parent form I have even tried a button to update although I can see no reason to have it as there is nothing in the fields upon return
1. DIM variables – same two global variables
2. Activate a Form/Browse Window – to reactivate the parent form
3. Set Field values – to set the form field values and therefore the database
4. Refresh the Display – to refresh the parent form just in case it doesn’t display without it.

This does not get the information to the parent form.
I have tried various other groupings of the action scripts with no positive results. Again thanks.
Lloyd

Tom Cone Jr
02-09-2004, 10:35 AM
Lloyd,

It almost sounds to me like you're trying to replicate the functionality of the existing table lookup field rules. They can easily be used to lookup field values from tables external to the current set. In fact, they work best that way. -- tom

lgoode
02-09-2004, 10:52 AM
I agree but have two masters and have found no way to select which file the field rules will display and return. Did I miss something in doing field rules? I will try it again and see if there is an option not seen before.

lgoode
02-09-2004, 11:05 AM
I tried this and there really are two or more files to select based on a code in the parent form but still nothing was returned. Thanks anyway.

Tom Cone Jr
02-09-2004, 11:08 AM
The source table for the lookup can be defined conditionally. If there's a field value in the record being edited, the field rule can use it to decide which source table to pull records from...

-- tom

lgoode
02-11-2004, 05:20 AM
Thanks Tom I was, after research, make this work.