Skip to main content
14-Alexandrite
July 15, 2019
Solved

External Data - Date&Time format

  • July 15, 2019
  • 1 reply
  • 2212 views

Hello friends


I need to display data in Chart from static time interval but I cannot solve how to correctly write startDate and endDate.

Date&Time format.png

Can you help me?

 

Thanks for every respond.

 

Tomas

Best answer by RolandRaytchev

Hi @TomasCharvat ,

I think this is issue with the converting of the correct data format. Your argument/parameters  here are strings what the QueryNumberPropertyHistory service seems not to "like"

So my suggestion is to create a TWX service where you will convert / parse the string

Example: 

2019-07-17_12-27-42.jpg

so here the code of the TWX service - input parameters max and min as strings.

 

var params = {
	oldestFirst: false /* BOOLEAN */,
	maxItems: 600 /* NUMBER */,
	propertyName: 'sensor' /* STRING */,
	endDate: undefined /* DATETIME */,
	query: undefined /* QUERY */,
	startDate: undefined /* DATETIME */
};
params.endDate = parseDate(max, "YYYY-MM-dd HH:mm:ss.SSS Z");
params.startDate =parseDate(min, "YYYY-MM-dd HH:mm:ss.SSS Z");
 
// result: INFOTABLE dataShape: "NumberValueStream"
var result = me.QueryNumberPropertyHistory(params);

 

Then in Vuforia Studio we need to add e.g.  the TestTing custom service getChartDataMinMax

 

2019-07-17_12-40-31.jpg

And we can test then in the preview:

2019-07-17_12-45-53.jpg

1 reply

21-Topaz I
July 17, 2019

Hi @TomasCharvat ,

I think this is issue with the converting of the correct data format. Your argument/parameters  here are strings what the QueryNumberPropertyHistory service seems not to "like"

So my suggestion is to create a TWX service where you will convert / parse the string

Example: 

2019-07-17_12-27-42.jpg

so here the code of the TWX service - input parameters max and min as strings.

 

var params = {
	oldestFirst: false /* BOOLEAN */,
	maxItems: 600 /* NUMBER */,
	propertyName: 'sensor' /* STRING */,
	endDate: undefined /* DATETIME */,
	query: undefined /* QUERY */,
	startDate: undefined /* DATETIME */
};
params.endDate = parseDate(max, "YYYY-MM-dd HH:mm:ss.SSS Z");
params.startDate =parseDate(min, "YYYY-MM-dd HH:mm:ss.SSS Z");
 
// result: INFOTABLE dataShape: "NumberValueStream"
var result = me.QueryNumberPropertyHistory(params);

 

Then in Vuforia Studio we need to add e.g.  the TestTing custom service getChartDataMinMax

 

2019-07-17_12-40-31.jpg

And we can test then in the preview:

2019-07-17_12-45-53.jpg