Forum Discussion

jpruddick's avatar
jpruddick
Occasional Contributor
6 years ago

Convert FindChild object to NameMapping object

Hi all,   I've been running into a problem in my code in which I need to find any object that fits certain properties- not a specific object, but just the first one that matches the criteria- and...
  • tristaanogre's avatar
    6 years ago

    You can't, not in code.  NameMapping is an object repository configured and created in design time to identifiy components.  Once it's been mapped, the objects then can be refernenced in code using Aliases.

     

    FindChild and find methods are dynamic runtime methods for finding and identifying objects.  You cannot convert that into the NameMapping because the NameMapping is not written to at runtime but only read from.

     

    What I would do is that, once you've found the object, persist it in a variable that is globally available.  However, if the object is destroyed in memory and recreated, anything stored in that variable will no longer be available.  So, you would need to find it again.  If it's such a dynamic object, that will probably be your best bet.