3 Replies Latest reply on Jul 28, 2017 11:37 AM by nicka

    Which attibutes are added to the symbol datasources list when an Element is added?

    Roger Palmen

      Hi all,


      I'm working on a custom symbol, and i'm looking into some details on what attributes are added to the list of symbol datasources (DatasourceBehaviors.Multiple) when an Element is added to the symbol. So far my experiments show:

      • All attributes on the Element
      • Of course hidden attributes are NOT included (attribute property Hidden)
      • Child attributes are NOT added, with the exception of Child attributes that have an attribute trait property set


      Is this a complete list?


      I want the user to drag an Element onto the display, and have the custom symbol configure itself based on the attributes. E.g. a chart scaling, based on the Minimum and Maximum traits.

      Now i need to get some additional child attributes from the element using the PI Web API. This i wanted to avoid to save latency on load. Of course i could abuse the forecast trait, but i don't like to abuse that...

      So that brings me to this. Of course there are other ways to implement this, e.g. just restructure my element to pull the attributes one level up.

        • Re: Which attibutes are added to the symbol datasources list when an Element is added?

          Hi Roger,


          What version of Coresight/Vision are you using?  On my system (Vision 2017), child attributes are returned for the DataSource.Multiple default symbols (trend, table, etc).  There is no additional logic for these symbols to pull in the child attributes.  If you're curious, check out the addTraces function that gets called when dataSources are added in PIVisualization.sym-trend.js - the datasources are passed in beforehand and not modified in the function.


          Anyway, after quite a bit of digging it seems as though the functionality to pull in the attributes when you select an element is offloaded to the PI Web API search controller.  For my particular test (pulling in an element called Well2), the URL that Vision used was:

          https://<server>/piwebapi/search/query?q=(name:Well2 OR attributename:Well2)&scope=af:\\PMARTIN-AF\Regions\Region\South\Houston\Well2&fields=Name;Description;UoM;DataType;ItemType;UniqueId;MatchedFields;Template;HasChildren;Paths;Attributes&count=1000


          You can use a similarly formatted URL to see what's returned from your Web API.  Make sure your database has been crawled after making changes.


          As an aside, I learned quite a bit researching this so thanks for the good question!

          1 of 1 people found this helpful
            • Re: Which attibutes are added to the symbol datasources list when an Element is added?
              Roger Palmen

              Using Vision 2017, so results should be the same. But it turns out i had not been paying attention to my test setup properly. All the child attributes i was missing were hidden...

              Thanks for the nice research! Did not expect the stock symbols to also rely on the PI Web API... I know there is something brewing wrt to the way data is delivered to symbols, but i did expect at least the stock symbols to rely on the data already in the various behaviour types.


              As long as one can avoid making another trip through the PI Web API no need to waiste the time and code on that!

                • Re: Which attibutes are added to the symbol datasources list when an Element is added?

                  From my experience, dragging in an element will always drag in all non-hidden children every time (including childrens children etc.) as long as the datasourceBehaviour of the symbol symbol is Multiple (for custom symbols note that the 'Value' config.DataShape will override Multiple to Single).


                  Something else to note is, if you make a custom symbol which is multi-source, the first attribute in the list (scope.symbol.DataSources[0]) is the attribute which the multi-state status is based upon, this can obviously be changed manually after the symbol has been turned into a multi-state or programatically.

                  2 of 2 people found this helpful