15 Replies Latest reply on Jul 29, 2015 12:51 PM by dng

    Array Types(Double Array)

    Anwar005

      Hi,

       

      Do you have any tutorial on how to use an array types, double array, for an AF attribute? I want to use double array as Value type for an attribute. My data source is oracle Db. Do I need to create special Data reference for it? Or can I use the existing one?

       

      Please guide me.

       

      Thanks,

       

      Anwar

       

       

       

       

        • Re: Array Types(Double Array)
          hanyong

          I don't think we have a tutorial specifically on what you are asking here. What you can do is, link a table from a OLEDB datasource into AF. After the table is linked, you can create an Attribute with "Table Lookup" reference, hence the attributes get value from the AFTable. If the attribute is configured with an array type, and your query to get data from the table returns a set of results, the results will be put into the array.

           

          AFArrayType.jpg

           

          There is a couple of places that you can take a look for reference here. Download the AF user guide from the Library section. Find it under "vCampus Products Kit -> Server Products -> AF User Guide". Look at Chapter 6 where there is a section "Configuring the Table Look-Up Data Reference" and Chapter 10, "Creating Tables" and "Importing/Linking to External Data". This should give you an idea how to configure it in PI System Explorer. Doing this programmatically would follow the similar idea, as long as you get how it works, it should be pretty easy.

           

          Hope this helps

            • Re: Array Types(Double Array)
              arm77

              Han Yong,

               

              Is it possible to store multiDimentional Array ?

               

              What do you suggest of storing Custom Objects in Attributes??

               

              Thanks

               

              AR

               

               

               

               

                • Re: Array Types(Double Array)
                  hanyong

                  As far as I know, there is no defined type for multidimensional array in AF. What kind of custom objects are you thinking of storing in AF? I think this other thread that Michael started might be of interest to you.

                    • Re: Array Types(Double Array)
                      cmanhard

                      AF does not support multi-dimensional arrays* as values. 

                       

                      You can store any other .NET Serializable object into AF, including .NET structures and classes.  However, you should be aware of the following if you store values other than the basic types seen in PI System Explorer:

                       

                      1) If the type is not avaiable on the client that AF is invoked from, then an error will occur when attempting to retrieve its value.  Note that care must be taken because there can be issues around versioning of .NET assemblies. 

                       

                      2) OSIsoft clients have no support for custom data types, now, or in the forseable future.  However, in PI System Explorer, if a TypeConverter exists which will convert to/from a String, then PI System Explorer will use this converter to allow reading/writing of the value.  Otherwise, just the type is shown.

                       

                      3) The data for Serializable object types is not otherwise understood by AF and will have limited use.  For example, there will be no search support, no ability to use in OSI Data References, no ability to store in PI, no ability to deliver via Notifications, it will not be retrievable by PIOLEDB, can't be used in WebParts, nor editted or displayed in PI AF Builder, etc.

                       

                      4) Care should be taken to limit the size of data stored in attributes as it will affect performance of retrieval.  For values of considerable size, use an AFFile.

                       

                      5) While AFImport/AFExport supports complex serialized values, the representation is binary encoded which makes it difficult to use.

                       

                      * AF can store jagged arrays (in C#: double[][]).  Multi-dimensional arrays (in C#: double[,]) currently cannot be stored because they get caught by the normal array processing which requires one dimension.

                        • Re: Array Types(Double Array)

                          Chris Manhard

                          However, in PI System Explorer, if a TypeConverter exists which will convert to/from a String, then PI System Explorer will use this converter to allow reading/writing of the value.
                          Can you please give more precisions on this? Where is that TypeConverter actually implemented/registered? Could a similar approach be used for other clients than PI System Explorer?

                            • Re: Array Types(Double Array)
                              cmanhard

                              TypeConverter's are part of .NET.  http://msdn.microsoft.com/en-us/library/system.componentmodel.typeconverter.aspx

                               

                              As I mentioned above, the use of custom types has some significant limitations, including the fact that the type needs to be contained in an assembly readily available on the client (for example, being in the GAC).  The TypeConverter needs to be accessible in the same way - typically implemented in the same assembly. 

                               

                              Because of the limitations, and because this is purely a .NET solution, it is not an approach that is appropriate for all clients.

                               

                               

                                • Re: Array Types(Double Array)
                                  ztsrg

                                  Dear Han Yong,

                                   

                                  is it possible to retrieve a specific value from an AF Attribute Array?

                                   

                                  For example, if I have one Attribute holding ten double values in an Double-Array.

                                   

                                  I would like to create now a new Attribute which shows the fifth value of this Double-Array?

                                   

                                  Is that possible in PI System Explorer?

                                   

                                  Many thanks in advance!

                                    • Re: Array Types(Double Array)
                                      jking

                                      Hi Gerrit,

                                       

                                      There is no native way in AF to create an attribute and specifically point it at a specific value of an array of values.  PSE does not as well.  The only way is to use the AF SDK and programatically retrieve the AFValue which is of type array from the attribute and then accessing the desired specific value in the array.

                                       

                                      Jason

                                        • Re: Array Types(Double Array)
                                          ztsrg

                                          Hi Jason,

                                           

                                          thanks for your answer. Now I can stop searching. ;-)

                                          • Re: Array Types(Double Array)
                                            andytimc

                                            Does this mean that the only way to display AF Array data in processbook is to use the AF SDK to pull out the individual array data? I was trying to work with this without needing to install the AF SDK on each processbook users PC.

                                             

                                            Thanks

                                              • Re: Array Types(Double Array)
                                                dng

                                                Hi Tim,

                                                 

                                                There are no out-of-the-box ways to display AF data from an array attribute in PI ProcessBook. The PI AF Client is already packaged with new versions of PI ProcessBook, you should not need a separate install of the PI AF SDK on the client machines.

                                                1 of 1 people found this helpful
                                                  • Re: Array Types(Double Array)
                                                    andytimc

                                                    Thanks Daphne,

                                                     

                                                    How about the VBA add-in? Will the wrapper need installed on each clients machine?

                                                      • Re: Array Types(Double Array)
                                                        dng

                                                        Hi Tim,

                                                         

                                                        You will have to register the AF Wrapper assembly on each client machine (with regasm.exe).
                                                        Is it possible to use basic AF attributes instead of array AF attributes? You can also consider writing a custom data reference to extract the array data into separate AF attributes.

                                                          • Re: Array Types(Double Array)
                                                            andytimc

                                                            I'm filling the arrays using a table lookup, and the table it linked to Active Event Frames. Because of this, the size of the array will vary. The goal is to display a listbox of active event frames in a processbook display and I'm really struggling to find an acceptable solution. I'd like the processbook displays to be element relative if possible as well. The client wants this to be very maintainable, and therefore contain very little custom code.

                                                              • Re: Array Types(Double Array)
                                                                dng

                                                                Hi Tim,

                                                                 

                                                                Yea.. even though a custom data reference does not need to be manually downloaded onto each client machine, the variation of array sizes will make implementation harder. I noticed in Case # 645247 that you are pursuing an OLEDB route to query for those event frames directly. Please let us know if there is anything we could help with that.