Adding Tags using IPIPoints2

Discussion created by tmcclure on May 9, 2013
Latest reply on May 13, 2013 by Gregor

There are a couple other conversations on this, but none of them display the conclusion.  I am exporting tags to PI by reading from a CSV file.  There will be approximately 5000 tags created all at once.  I am writing this because I don't want to manually input all of the tags one by one.  So I figured I could write an application faster and still have my sanity by the end of it.




I created a function called CreatePIPoints that takes several provided variables from the CSV file and includes them as attributes.  Every other attribute is consistent with all of the created tags.  I am using the IPIPoints2 method, but I am not sure what I am doing wrong.  The application runs correctly and doesn't output any errors, but I don't see any update on the PI server, nor in the message logs.  Any help you can provide would be greatly appreciated!







public void CreatePIPoints(string tagName, object description, object engunits, int typicalValue)

                 IPIPoints2 IPIP2 = (IPIPoints2)_piserver.PIPoints;

                 NamedValues nvsAddPoints = new NamedValues();
                 PIErrors myAddErrors = new PIErrors();
                 PointList list = new PointList();
                 NamedValues nvsAttributes = new NamedValues();

                 nvsAttributes.Add("pointtype", "float32");
                 nvsAttributes.Add("archiving", 1);
                 nvsAttributes.Add("compdev", 100);
                 nvsAttributes.Add("compdevpercent", 5);
                 nvsAttributes.Add("compmax", 28800);
                 nvsAttributes.Add("compmin", 0);
                 nvsAttributes.Add("compressing", 0);
                 nvsAttributes.Add("datasecurity", "piadmin: A(r,w) | piadmins: A(r,w)");
                 nvsAttributes.Add("descriptor", description);
                 nvsAttributes.Add("displaydigits", 10);
                 nvsAttributes.Add("engunits", engunits);
                 nvsAttributes.Add("excdev", 50);
                 nvsAttributes.Add("excdevpercent", 2.5);
                 nvsAttributes.Add("excmax", 600);
                 nvsAttributes.Add("excmin", 0);
                 nvsAttributes.Add("instrumenttag", tagName);
                 nvsAttributes.Add("location1", 1);
                 nvsAttributes.Add("location2", 12);
                 nvsAttributes.Add("location3", 0);
                 nvsAttributes.Add("location4", 1);
                 nvsAttributes.Add("location5", 0);
                 nvsAttributes.Add("pointsource", "NOMS");
                 nvsAttributes.Add("ptclassname", "classic");
                 nvsAttributes.Add("ptsecurity", "piadmin: A(r,w) | piadmins: A(r,w)");
                 nvsAttributes.Add("scan", 1);
                 nvsAttributes.Add("span", 2000000);
                 nvsAttributes.Add("typicalvalue", typicalValue);
                 nvsAttributes.Add("zero", -1000000);

                 NamedValues nvsTagsAndAttributes = new NamedValues();
                 nvsTagsAndAttributes.Add(tagName, nvsAttributes);

                 IPIP2.AddTags(nvsTagsAndAttributes, out myAddErrors, out list, null);

                 foreach (PIError myError in myAddErrors)

             catch (Exception ex)