Updating one file from within another
GCC Consulting
gcc at optonline.net
Thu Apr 29 13:54:58 PDT 2004
-----Original Message-----
From: filepro-list-bounces at lists.celestial.com
[mailto:filepro-list-bounces at lists.celestial.com] On Behalf Of Joe Chasan
Sent: Thursday, April 29, 2004 2:13 PM
To: filepro-list at seaslug.org
Subject: Re: Updating one file from within another
On Wed, Apr 28, 2004 at 04:04:51PM -0400, Vicky Prigg wrote:
> I would like to, while in one file, open up a new record in another
> file and be able to post data to it and then update the new record
> with the rest of the data that I need. Right now, I am using lookup
> to a free record and posting the data over. I used a SYSTEM command
> to take me to the screen in the other file. I can't use POPUP UPDATE
> because I need some input processing to take place in the lookup file.
> My problem is, I can't tell the SYSTEM command to go into that record
> that I just created from the lookup. The SYSTEM command just takes me
> to index selection using the -xi flag. I can't even use a saved
> selection set because the value of the field changes with every record.
you should capture the record # (or some other unique key) when you create the
record.
when going into the second file via system command, pass the record # (or other
unique key) along on the command line via -r, -rw, -rx, -ry, or -rz (these will
correspond to system variables @pm, @pw, @px, @py, and @pz, respectively.)
in the second file, use @menu processing and if that value is set in the
@pm/@pw/@px/@py/@pz - whichever you decide to use, use the "lookup - r=(that
record #" to put yourself directly onto that record - you can take it further
and put yourself into update as well as force exit from the file when done if
you want.
note - your selection set idea wasn't bad - you can still do that if you want by
either actually writing the selection set from the first file or most easily by
combining the above with a saved selection such as "@rn eqf @pm" or
"some-key-field-value eqf @pm"
------------------------------------------------------------------------
You can also use @once processing to get to the record you are trying to update.
There is one other solution you can use and this depends on how much
information(read fields) need to be processed.
Define duplicate screen(s) using dummy fields and copy in your processing and
change the real fields to dummy fields. You can then gather all of you
information in your current file and the post it when done without the need for
a system call.
Remember, you can map an array to you dummy fields (dim array(15):aa) set dim
second array to the lookup file and then just loop thru array 1 copying the data
to array 2 to post all of the data using a minimum of programming.
This method takes a little more effort, but insures that the data posted is
accurate prior to creating the new record.
Your choice
Richard Kreiss
GCC Consulting
More information about the Filepro-list
mailing list