How can the ConfigString of an AFDataReference of type Table Lookup be set programmatically

Discussion created by AvanadeShellSSP on Sep 25, 2014
Latest reply on Sep 25, 2014 by jking

Hi All,


Programmatically (C#) we are trying to set the ConfigString property of an AFDataReference of type Table Lookup.


Setting the ConfigString for the type Table Lookup throws a NullReferenceException: 



AFAttribute attribute = element.Attributes.Add(attributeName);
attribute.DataReferencePlugIn = plugin;           // of type Table Lookup
attribute.DataReference.ConfigString = "value;"; // throws a NullReferenceException

Same code works when the type of AFDataReference is for example String Builder.


We have workaround where we first create the attribute, call apply changes and retrieve the atribute for second time. And then it works fine: 

AFAttribute attribute = element.Attributes.Add(attributeName);
attribute.DefaultUOM = uom;
attribute.DataReferencePlugIn = plugin;  // of type Table Lookup


AFAttribute attribute2 = GetAttribute();
attribute2.DataReference.ConfigString = "value;"; // works fine



is there way to set the ConfigString of a AFDataReference of type Table Lookup at creation?




Kind Regards.