cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Counting a result value from service ?

vvu
1-Newbie
1-Newbie

Counting a result value from service ?

Let me clarify this problem:
I have a properties "doorSensor" and the value is true/false - which represent for open and close the door.

I used general service "QueryBooleanPropertyHistory" to get all the result in a week, which return a list of time and the value true/false.

How can I  use aggregate function with this result , I need a total of times that door is open and close. Is it relate something with text field query in the service ?

1 REPLY 1
ankigupta
5-Regular Member
(To:vvu)

Hi vietanh vu​,

I think you are on the Right track.

You can use aggregates as COUNT and group by column using groupByColumns to get the total count for open and close.

var params = {

    t: undefined /* INFOTABLE */,

    columns: undefined /* STRING */,

    aggregates: undefined /* STRING */,

    groupByColumns: undefined /* STRING */

};

// result: INFOTABLE

var result = Resources["InfoTableFunctions"].Aggregate(params);

Do let me know if you face any issue.

Announcements


Top Tags