Hi, I want to trigger this Create or Update Data Reference the same way as in Pi System Explorer in C#. I found method DataReference.CreateConfig()
Want to make sure it's the same thing.
Yep, that is the correct method to call, and will give you the same outcome as what you see in PSE.
Hi, Is there a way (which property) to tell, for a given element where all Pi Tags were created ? Which means Create Data Reference has been called before for a given element.
Not directly. Two ideas:
To tell if the PI tag can be resolved, check if the .PIPoint property throws an exception upon access. Or, better yet, just call a bulk GetValue on your attribute list and examine the errors/values - perhaps a value of "Pt Created" us a useful heuristic. These aren't foolproof for your use case - imagine the case where some of the tags already exist.
To tell if CreateConfig may have been run, you could check equality between the attribute's ConfigString and the attribute template's ConfigString. For the PI Point data reference, running CreateConfig will fully resolve the PI tag and will create or update if configured. The ConfigString of each attribute will reflect this. Of course, you could get a false positive if the attribute ConfigString had been altered manually.
Anyone else have a better way?
Retrieving data ...