6 Replies Latest reply on Oct 31, 2012 3:54 AM by mark.omeara

    Custom AF Value Type

    mark.omeara

      Hello

       

      Is it possible, via the SDK, to code a custom value type? For example I wish to have a value type similar to the Enumeration set type where a user is presented with a combobox control of available values, however instead of using enumeration items entered via the Library module I wish to use some other list (such as a list of Element Category GUID vs Element Category Name).

       

      To clarify let say I enter the following Element Categories into AD 'Pump', 'Motor', 'Robot'. Now I want to define an AF attribute that lets the user select one of these categories, behind the scenes the category GUID is stored in the attribute, but the category name is displayed.

       

      Thanks

       

      Mark

        • Re: Custom AF Value Type

          Hello Mark,

           

          When using PI System Explorer, I can create Element Categories in the Library and assign them when creating AF Elements. It's possible to assign more than one Category to a single Element. The dialog that is offered to chose from existent Categories also allows to create new Categories.

           

          When changing the name of an existent Element Category, the name change is reflected with all Elements belonging to the particular Category. This tells me that AF is using ID's internally rather than the Category names.

           

          Are you asking how to retrieve those ID's?

           

          Are you asking how to assign a Category to an Element programmatically?

           

          Gregor

            • Re: Custom AF Value Type
              mark.omeara

              Perhaps my example of Categories has muddied the waters somewhat. Let me try again. The Enumeration Value Type for an Attribute of an Element allows the AF user to use a combobox to select a value.

               

              I want to be able to have an Attribute that allows the user to select from a combobox a set of values from some other system, such as a linked table/view or from other AF objects via the SDK or OLE-DB.

                • Re: Custom AF Value Type

                  Hello Mark,

                   

                  With the "Data Reference" ComboBox in PI System Explorer you have the choice between <None>, Formula, PI Point, PI Point Array and Table Lookup.

                   

                  The "Value Type" ComboBox offers a rich choice of basic, array and object types.

                   

                  To select data from a relational database, please have a look into Table Lookup Data Reference. Please note that you need to define a Table first in the Library.

                   

                  With the upcoming PI AF 2012 release Table Lookup is improved significantly and support for Time Series data will be introduced.

                   

                  When you refer to SDK, are you talking about PI SDK or AF SDK?

                   

                  When you refer to OLE-DB, do you mean PI OLEDB (classic) or PI OLEDB Enterprise?

                   

                  Please note that you need the AF SDK / PI OLEDB Enterprise to access PI AF.

                   

                  Gregor

                    • Re: Custom AF Value Type
                      cmanhard

                      PI System Explorer will only display the combo box drop down for attribute values of type AFEnumerationValue and bool.  If you attach a data reference to the attribute, it is possible for the data reference to define a "value editor".  If defined, the ... button will appear to the right of the value (similar to how arrays and files appear).  

                       

                      While you can store any .NET Serializable object into an attribute, caution is advised as the types must be available within the GAC on every client and are subject to versioning issues.  OSIsoft clients will not be able to expose custom data types.  This includes ProcessBook, Coresight, WebParts, Datalink, PI OLEDB Enterprise, Web Services, and PI AF Builder.  AF Import and Export will not expose such types in a human readable/editable format.

                        • Re: Custom AF Value Type
                          aabrodskiy

                          I guess what you could do is write a custom data reference.

                           

                          This data reference would retrieve a list of categories from the AF and user would be able to select them via Data Reference settings.

                           

                          You would have to store the GUID of selected category in the Configuration String of the Attribute. And you can resolve this GUID into the Category Name at runtime by that DataReference and return it to users in the Value field of the Attribute.

                            • Re: Custom AF Value Type
                              mark.omeara

                              Thanks Chris and Alex, that was what I was after.

                               

                              It does not appear possible without a lot of additional work in that case.

                               

                              Gregor, the Table Lookup does not allow a selection box based on the table fields for user selection, in this manner it is not like the Enumeration type features.

                               

                              Thanks for your help all, I do not think I shall pursue this as an option.

                               

                              Mark