ho to get an object knowing the dbId

M

Marcel Preda

Guest
Hi there,

I have a string which represents an object Id.
E.g. myVar = "db:0x5eb50da6"

How can I acces something like dbId(myVar)->myProperty ?


The background:
I have a report field form, and in one column I have to make a
reference to some shapes.
When user clicks on a row I want to highlight the associated shape.
The problem with the report field is that I can use as types only
integers, floats or strings - no something like dbId is allowed.
So I decide to put there the dbIds as strings in a column of the field
report.

Of course I can build a global hash with the dbIds as keys and the
associated object as value,
but I already have some global vars and I don't like it too much, I
would like to avoid creation of a new global var.

Thank you,
Marcel
 
Marcel Preda wrote, on 07/06/10 11:25:
Hi there,

I have a string which represents an object Id.
E.g. myVar = "db:0x5eb50da6"

How can I acces something like dbId(myVar)->myProperty ?


The background:
I have a report field form, and in one column I have to make a
reference to some shapes.
When user clicks on a row I want to highlight the associated shape.
The problem with the report field is that I can use as types only
integers, floats or strings - no something like dbId is allowed.
So I decide to put there the dbIds as strings in a column of the field
report.

Of course I can build a global hash with the dbIds as keys and the
associated object as value,
but I already have some global vars and I don't like it too much, I
would like to avoid creation of a new global var.

Thank you,
Marcel
Hi Marcel,

The simple answer is you can't. You should not rely on dbId (especially by name)
because they are not consistent from one session to the next.

Even storing dbIds in data structures is a little risky, because the user could
do stuff in the meantime which makes them invalid (e.g. they could delete them)
and it is possible for dbIds to get reused in some cases.

However, you could create a hash to look them up some how. The hash (using
makeTable) does not need to be stored in a global variable; it could be stored
as a property on the form you're creating.

Best Regards,

Andrew.
 

Welcome to EDABoard.com

Sponsor

Back
Top