I would like to achieve similar functionality as PI SMT, where you are able to search PI Points according to status. How can I construct whereClause to contain condition with status property?
Have a look at the Server.GetPointsSQL method
I know about that variant. But I would like to use GetPoints2 method. Is it possible to create where clause with status? Thanks for quick answer.
One of the parameters for the GetPoints2 method is to specify to search using GetPoints or GetPointsSQL as a search mode. In this case, you can choose to use GetPointsSQL.
OK, I got you. Thank you. In fact I have already implemented getPoints2 method with GetPoints parameter. Is it possible to use this method for searching according to status?
PISDK::_PointListPtr l_spList = l_spPoints2->GetPoints2(l_whereClause, l_spAttributes, PISDK::useGetPoints, l_spasync, NULL, NULL);
I'm sorry for misunderstanding.
GetPoints only allow you to search for PIPoints based on point attributes (like descriptor or pointid), but not based on values and status of the points. Hence if you want to implement a search based on status, you should use GetPointsSQL to use the status as a search criteria. It is still possible to use GetPoints2 method for this, because the 3rd parameter can be set to PISDK::useGetPointsSQL. Your query will probably be different from your current implementation.
I don't have a code snippet in C++ for this, but in C# it is something like:
IGetPoints2 igp2 = (IGetPoints2)piserver;NamedValues nvtables = new NamedValues();nvtables.Add("picomp", "picomp");PointList ptList = igp2.GetPoints2("pipoint.tag Like 'cd*' AND pipoint.tag = picomp.tag AND picomp.status > -65536 AND picomp.status < 0 AND picomp.Date('*')", null, GetPointsRetrievalTypes.useGetPointsSql, null, nvtables, null);
thank you! This is exactly what I'm looking for!!
Retrieving data ...