I need help on setting up a Stored Procedure (AF-SDK) to trigger an update to a PI tag value (Timestamp & value). What is the best way to accomplish this?
You posted your question under PI SQL Data Access Technologies and ask about setting up a Stored Procedure what also indicates you refer to a SQL product but in brackets you mention AF SDK. Did you intend to ask for PI OLEDB Enterprise Provider specifically? If so, and because you are asking to update PI Point data, please note that PI OLEDB Enterprise provides read-only access.
PI OLEDB (Classic) Provider provides read / write access to the PI Data Archive and I believe to remember that it is possible to create functions there but PI OLEDB Provider is using PI SDK under the hood.
I did some research and stumbled across Marcos' blog about Developing an CLR assembly with PI SDK. Is this what you are looking for?
Will this allow me to create a Stored Procedure and just pass the PI tag and timestamp and value?
Sent from my iPhone
As far as I can see, Marcos' example is about updating a points snapshot where parameters are piServerName, piPointName and snapshotValue. This is not exactly what you are asking for but the example should enable you to create the Stored Procedure that you are looking for.
Thank you for this information. This will at the very least get me started.
The blog post that Gregor has mentioned actually uses PI SDK and not PI AF SDK under the hood. As the recommended approach is PI AF SDK, I wouldn't develop a solution using an old technology.
What I do suggest for you is to use PI Web API instead. On this apprach, your CLR Stored Procedure will make HTTP requests against PI Web API in order to retrieve/update values on your PI System. There are three reasons for choosing this new apprach:
1) PI Web API is developed on top of PI AF SDK which is our fastest and the most complete PI Developer Technology.
2) PI Web API is a RESTful web service. Therefore, you don't need to add OSIsoft libraries to your CLR project. You might want to add JSON.NET in order to process JSON responses though.
3)It is easier to maintain as you don't need to update PI AF SDK on all the clients machines using your CLR library. You just need to update PI Web API on the web server.
I have never tried to do that but I don't see any reason why it won't work,
You might want to refer to the following blog post: Accessing REST based Web services using SQL CLR - SQL Server - The One Stop Shop - Site Home - MSDN Blogs.
Hope it helps!
Retrieving data ...