I have a table with two fields configured as integer autoinc.This is a father 
table. The child table is invdetails.

Both tables are within a transaction

The table is replicated in a cursor adapter, ie, the actual table is 
invtotals.dbf and the cursor adapter is called curInvTotals
The autoinc fields are:

id  int autoinc with a current value of 1234
ctl int autoinc with a current value of 5687

I append a record to the cursor (curInvTotals), add the data for all fields, 
remove both autoinc fields from the CA and save everything with tableupdate()
(the buffering is set to 5) The removal is done so as to avoid an error since 
the autoinc fields are readonly (I do not want to use set autoincerror)

As a result of the addition of 1 record, the first field, (the PK) becomes 
1235. I obtain its value with getautoincvalue() and store it into a property to 
be used for including in every record in the child table (invdetails)

My question is, how can I determine the value of the ctl field (which should 
now have become 5688)? The getautoincvalue function only gives me the increment 
value of the first field in the table (id), but not the value of the second 
field (ctl)

The pseudocode of what I am doing is:

begin transaction
append one record to the father table (both autoinc fields add 1 to the number 
already there)
replace the remaining records with the invoice total, taxes, date,customer 
number, etc
remove both autoinc fields from the cursor (a cursor adapter)
save this table with tableupdate
get the PK value from the autoincremental field with getautoincvalue()
if save is OK proceed to saving all records in the child table
select child table
replace foreign key field in all records with PK from father table (obtained 
with getautoincvalue)
save child table with tableupdate
if save is ok then end transaction otherwise rollback

I need the second autoincremental value from the father table, the control 
field ctl, to replace in the appropriate field in the child table.

So again, how can I obtain this value?

TIA
Rafael Copquin

 


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to