andyromero

How to retrieve a list of PIPoints by given list of tags

Discussion created by andyromero on May 28, 2013
Latest reply on May 29, 2013 by andyromero

Hi,

 

I´m a newbie in PISDK development and i would like to know a efficient method to retrieve a list of PiPoints by a given list of tags.

 

Here is a piece of code that i wrote in order to achieve such result

 

StringBuilder whereClause = new StringBuilder();
whereClause.Append("Tag in (");
whereClause.Append(csvWithQuote);
whereClause.Append(")");
PISDK.Server piServer = getServer(host, userName, password);
return piServer.GetPointsSQL(whereClause.ToString());

 

where csvWithQuote is a comma separeted tag values.

 

The above code works fine, but by passing a plenty of tags say about 90 tags it turns very slow.

 

What could i do to achieve a better performance?

 

The  above code uses only one network call?

 

If rewrite the above code to this one:

 

PISDK.Server server = getServer(host, userName, password);
PISDK.PointList pointList = new PISDK.PointList();
PISDK.PIPoint point = null;
foreach (String tag in tags)
{
try
{
point = server.PIPoints[tag];
pointList.Add(point);
}
catch {}
}
return pointList;

 

It performs better although i believe it does several network calls.

 


 

I really apreciate any help.

 

 

 

 

 

 

Outcomes