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

169 views Asked by At

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?

1

There are 1 answers

0
Teejay On BEST ANSWER

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

attr.Domain.Name

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