Skip to main content
1-Visitor
September 3, 2019
Question

Multi-aggregate function in one service.

  • September 3, 2019
  • 0 replies
  • 736 views

Hi. Now I am doing single aggregate function for real data and I want to proceed to multiple field aggregate function. Like I want to calculate each target and real data number for average using one service because I want to show both of them in one label chart. how to combine them in one service?

 

var result = Resources["InfoTableFunctions"].RenameField({
	t: Resources["InfoTableFunctions"].Aggregate({
 t: me.QueryDataTableEntries({ maxItems: undefined,
 query: query,
 values:undefined,
 source: undefined,
 tags:undefined
 }),
 columns: 'value,Target',
 aggregates: 'AVERAGE',
 groupByColumns: 'month'
 }),
	from: "AVERAGE_value,AVERAGE_Target",
	to: "value,Target"
});

After that, thingworx will show Error executing service QueryByMonth_Cost_Cheese_OE_LineA. Message:: Wrapped java.lang.NullPointerException - See Script Error Log for more details