Hi All;
When merging two databases, I've run across a thorny problem. It goes like this:
At the topmost level of the database, I'm using a 'ledger' file to have unique ledger accounts--system assigned with sys(2015). This ledger file then has its primary key, caccount, cascaded down to multiple files, in particular, 'people', 'company', 'policies', and 'billing'. caccount is the primary key in people, company, and policies, but is a referenced key as cpayor in the billing file. This arrangement has worked fine over the years, successfully letting the billing file 'bill' whichever payor was referenced in the cpayor field.
However, when 'merging' two databases from seperate offices, there has been occasions when one or more of the accounts --people, company, or policy--has to be moved to a different ledger account. That's not a problem directly, except when the child record in people, company, or policy, is moved from its original parent ledger, it leaves that ledger record and the billing record that references the ledger record meaningless.
I can think of no way that changes in the primary key, caccount, of either people, company, or policy, can be autmatically cascaded to the single cpayor field of zbilling, nor does it make sense when changing the primary key of a child record to trace up the tree to its original parent and change its primary key as well.
The only solution I can think of is to expand the cpayor field in zbilling into three seperate fields, one for each type of account, but then how would I 'insert' a billing record where these three fields are restricted to legitamate values without using a 'blank' record in people.dbf, company.dbf, or policy.dbf? Or, is there a way of reversing this somehow and make people, company, AND policy all parents of the single caccount entry in ledgers.dbf?
I'm open to any and all suggestions!
Thanks,
ajw
When merging two databases, I've run across a thorny problem. It goes like this:
At the topmost level of the database, I'm using a 'ledger' file to have unique ledger accounts--system assigned with sys(2015). This ledger file then has its primary key, caccount, cascaded down to multiple files, in particular, 'people', 'company', 'policies', and 'billing'. caccount is the primary key in people, company, and policies, but is a referenced key as cpayor in the billing file. This arrangement has worked fine over the years, successfully letting the billing file 'bill' whichever payor was referenced in the cpayor field.
However, when 'merging' two databases from seperate offices, there has been occasions when one or more of the accounts --people, company, or policy--has to be moved to a different ledger account. That's not a problem directly, except when the child record in people, company, or policy, is moved from its original parent ledger, it leaves that ledger record and the billing record that references the ledger record meaningless.
I can think of no way that changes in the primary key, caccount, of either people, company, or policy, can be autmatically cascaded to the single cpayor field of zbilling, nor does it make sense when changing the primary key of a child record to trace up the tree to its original parent and change its primary key as well.
The only solution I can think of is to expand the cpayor field in zbilling into three seperate fields, one for each type of account, but then how would I 'insert' a billing record where these three fields are restricted to legitamate values without using a 'blank' record in people.dbf, company.dbf, or policy.dbf? Or, is there a way of reversing this somehow and make people, company, AND policy all parents of the single caccount entry in ledgers.dbf?
I'm open to any and all suggestions!
Thanks,
ajw