ho to get an object knowing the dbId

Discussion in 'Cadence' started by Marcel Preda, Jul 6, 2010.

  1. Marcel Preda

    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, Jul 6, 2010
    #1
  2. Marcel Preda wrote, on 07/06/10 11:25:
    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.
     
    Andrew Beckett, Jul 9, 2010
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.