Retrieve Data state values from PI OLEDB using C#

Discussion created by james_langham on Sep 17, 2012
Latest reply on Sep 17, 2012 by Sam Pride



Firstly, this is my first time posting on these forums so please forgive my ignorance.


I have been learning PI for about 2 months now and am starting to get to grips with it, although I would still consider myself a beginner.


My query relates to using PI SDK to search for and display archive values from PI OLEDB.


I've got a basic program that opens a connection to OLEDB and searches  tags based on an input text file.


This all works fine until I get to tags that have a digital state for there values, I get  results like '-458754'


It is my understanding that PI stores digital state values like this, a negative 6 digit number, and  converts it back when displayed.


If this is the case, how can I use PI SDK to either get the actual string of the digital state or use C# to convert it from the stored value back to the digital state value?


Any advice would be appreciated.




EDIT: I believe I found the answer, I can use the DIGSTRING sql command to convert a digital state code to a name when I query OLEDB