Hi
I am trying the Demo of A5 so I thought I might try converting an application I wrote long long ago in Clipper.
The part I am stuck on right now is:
I have imported two tables from the old app, a customer table "customer.dbf" and an orders table "standord.dbf".
The original design related the two tables one to many by a manually entered customer code. I want to replace this key field with an auto increment field named ID.
To implement the new relationship I have created a field called ID in each table and have populated the Customer->ID field with the incrementing IDs.
My problem is copying this ID from the "customer" record to the related "standord" child records using Xbasic.
I have a created a Set which I have called "fix cust_standord_set" based on the old relationship with customer related to standord by customer field in a one to many relationship. The parent and child records are all related perfectly on the old key field.
I have previously been able to modify and update fields in a single table but I can't make the leap to sets.
I am not sure how to write to fields in different tables in a set. I have not been able to stumble on an answer in the help or the forum. I am confused about issues such as where to use set pointers ands where to use table pointers.
I was trying solutions based on the following skeleton.
My understanding is that I should be able to loop through the set and copy Customer->ID to Standord->ID for each record sequentially, one record at a time from beginning of file to end.
dim sptr as P
dim ctbl as P
dim stbl as P
sptr=set.open_session("fix_cust_standord_set")
sptr.fetch_first()
WHILE .not. sptr.fetch_eof()
'need instruction here
'copy customer->id to standord->id
sptr.fetch_next()
END WHILE
' Close Table
sptr.close()
Thanks
I am trying the Demo of A5 so I thought I might try converting an application I wrote long long ago in Clipper.
The part I am stuck on right now is:
I have imported two tables from the old app, a customer table "customer.dbf" and an orders table "standord.dbf".
The original design related the two tables one to many by a manually entered customer code. I want to replace this key field with an auto increment field named ID.
To implement the new relationship I have created a field called ID in each table and have populated the Customer->ID field with the incrementing IDs.
My problem is copying this ID from the "customer" record to the related "standord" child records using Xbasic.
I have a created a Set which I have called "fix cust_standord_set" based on the old relationship with customer related to standord by customer field in a one to many relationship. The parent and child records are all related perfectly on the old key field.
I have previously been able to modify and update fields in a single table but I can't make the leap to sets.
I am not sure how to write to fields in different tables in a set. I have not been able to stumble on an answer in the help or the forum. I am confused about issues such as where to use set pointers ands where to use table pointers.
I was trying solutions based on the following skeleton.
My understanding is that I should be able to loop through the set and copy Customer->ID to Standord->ID for each record sequentially, one record at a time from beginning of file to end.
dim sptr as P
dim ctbl as P
dim stbl as P
sptr=set.open_session("fix_cust_standord_set")
sptr.fetch_first()
WHILE .not. sptr.fetch_eof()
'need instruction here
'copy customer->id to standord->id
sptr.fetch_next()
END WHILE
' Close Table
sptr.close()
Thanks
Comment