Adding Multiple tags at once IPIPoints2 C#

Discussion created by Kmeagher on Aug 26, 2010
Latest reply on Aug 30, 2010 by spilon

I'm currently trying to create an application that Parses a text file and pulls out the neccesary information required to create a list of tags ~3500 for now. Nothing wrong with my Parsing the textfile (and if there was I wouldn't bother you fine people with that ). So far I take the desired tagName, description, units, classname, and if applicable digitalset and attempt to add them to the PI Server via IPIPoints2.AddTags in a manner similar to this:

PISDK.Server myServer = g_SDK2.Servers[servPickList2.SelectedServerName.ToString()];     // server object from the name in server pick list
PISDK.IPIPoints2 IPIP2 = (PISDK.IPIPoints2)myServer.PIPoints;
PISDKCommon.NamedValues nvsAddRemove = new PISDKCommon.NamedValues();
PISDKCommon.PIErrors myAddErrors = new PISDKCommon.PIErrors();
PISDK.PointList myPtList = new PISDK.PointList();
PISDKCommon.PIErrors myRemoveErrors = new PISDKCommon.PIErrors();
string tagName = "";
string trueMsg = "";
string falseMsg = "";
object descriptor = "";
object engUnits = "";
object pointType = "";
object className = "classic";
object digitalSet = "";
object pointSource = "L";
foreach (string item in listOfNeccesaryInformation)
    String[] cs1 = item.Split(';');
    PISDKCommon.NamedValues nvsTagAttr = new PISDKCommon.NamedValues();
    tagName = cs1[0].Trim();
    engUnits = cs1[2].Trim();
    trueMsg = cs1[3].Trim();
    falseMsg = cs1[4].Trim();
    descriptor = cs1[5].Trim() + " LocationId: " + cs1[ 6].Trim() + " ValueId: " + cs1[7].Trim();
    pointType = PISDK.PointTypeConstants.pttypFloat32; //digital if applicable
    nvsTagAttr.Add("ptclassName", ref className);
    nvsTagAttr.Add("pointtype", ref pointType);
    nvsTagAttr.Add("Descriptor", ref descriptor);
    nvsTagAttr.Add("EngUnits", ref engUnits);
    nvsTagAttr.Add("pointsource", ref pointSource);
    object nvsTagAttr2 = nvsTagAttr;
    nvsAddRemove.Add(tagName, ref nvsTagAttr2);
IPIP2.AddTags(nvsAddRemove, out myAddErrors, out myPtList, null);


No compile issues but when I run through the loop it doesn't create any of the points. If I debug it "myAddErrors" has ~3500 errors (I guess is what it means), can someone tell me what I'm doing wrong, or at least how to access the errors that are listed under "myAddErrors"?




-Thank You