Can I change a field's ObjectPtr target BaseObject without losing the field values?

Ruslan Zasukhin sunshine at public.kherson.ua
Sat Apr 10 09:30:06 CDT 2004


On 4/9/04 10:09 PM, "Keith DeLong" <delong at redcort.com> wrote:

Hi Keith,

> In an existing V4RB database, I have a  number of ObjectPtr fields that
> point to a table. I need to point all these to a different table in an
> upcoming release.
> 
> I populate the new table using a record order identical to the old one (thus
> preserving the recID).

Here can be mistake!

You talk probably about logical order.
But RecID this is physical number of records,
So if you have at least one deleted record, you cannot reproduce the same
order. 


> When I next change the target baseobject on the
> ObjectPtr fields to point to the new table, the existing ObjectPtr field
> values are all set to 0. This destroys all my table relationships.
> 
> Is there a workaround to this behavior? Do I have to export each table's
> ObjectPtr field values and then reimport them into the field after changing
> the its target baseobject? Any other ideas?

1) you can try change type ObjectPtr to ULONG, then back to ObjectPtr.
    although I could insert protection here also, which zero old values.

2) another way:
    in old tables you add RDB PTR field and RDB KEY fields,
    make iteration to link PTR to KEY using ObjectPtr values.
    kill old ObjectPtr and make new ObjectPtr to other table
    Other table can repeat KEYs of old table
    use Convert RDB to ObjectPtr command
    remove PTR and KEY fields.


Not easy, yes?

> I have a pretty good size customer base with up many years worth of data so
> this has to be accomplished programmatically from within REALbasic.

I see.




-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list