toadtoad-scripting

Toad data modeler scripting: Entity.Attributes[i].Domain returns undefined


I'm trying to programmatically retrieve the domain of a table's field.

We only use domains in our model, as shown below:

enter image description here

The code is the following:

for (var counterAttr = 0; counterAttr < TableObject.Attributes.Count; counterAttr++)
{ 
   var attr = TableObject.Attributes.GetObject(counterAttr);

   Log.Information("Field[" +counterAttr +"]: " + attr.Name + " (" + attr.Domain + ")");  
}

But unfortunately it outputs as follows:

Field[0]: LDAP_USED_GROUP_ID (undefined)
Field[1]: LDAP_DOMAIN_ID (undefined)
Field[2]: LDAP_USED_GROUP_NAME (undefined)
...

Any ideas?


Solution

  • The solution, found through Toad forums, is to use:

    attr.Domain.Name
    

    even if attr.Domain itself is undefinded... who knows?