Lonnie Bowling

How to set a data reference when creating an element

Discussion created by Lonnie Bowling Champion on Jul 5, 2012
Latest reply on Oct 7, 2014 by g.vilkner

Hi Everyone,


This seems like a very simple problem that I just can't figure out, isn't is always like that?  I am creating AF Elements programmatically and am trying to configure an attribute with a data reference for a formula.  Here is the code that does not work:



        private static AFAttribute CreateAttributeWithConfig(AFElement Element, string Name, string Description, string Config)
            // Create an Attribute
            AFAttribute myAttribute = Element.Attributes.Add(Name);
            myAttribute.Description = Description;                
            myAttribute.DataReference.ConfigString = Config;
            return myAttribute;



The myAttribute.DataReference is set to null when I call this function and I'm lost on how to set it correctly.  I figure I need to set the ConfigString to what I see in AF when I read an element attribute that is similar to what I want to do.  Something like this:




Any help would be appreciated!