queryHistory usage

I try to query History from gateway scope with :
context.getTagManager().queryHistory(tagHistoryQueryParams, streamingDatasetWriter);

tagHistoryQueryParams.setPaths(); is used to provide tagPaths.
In the BasicTagPath, do we need to provide the history provider in the source ?
In this case what is the form/synthax to use ?

Probably the tag provider is enough, the history provider is resolved with it.

@PGriffith
I try to create a BasicTagHistoryQueryParams, but Iā€™m looking for an example for those settings :

tagHistoryQueryParams.setAggregationMode();
tagHistoryQueryParams.setAliases();
tagHistoryQueryParams.setColumnAggregationModes();
tagHistoryQueryParams.setEndDate()
tagHistoryQueryParams.setStartDate();
tagHistoryQueryParams.setQueryFlags();
tagHistoryQueryParams.setReturnFormat();
tagHistoryQueryParams.setReturnSize();

With only the following :

(startDate => now + 1 days
endDate => now - 2 days)

tagHistoryQueryParams.setEndDate(startDate);
tagHistoryQueryParams.setStartDate(endDate);
tagHistoryQueryParams.setReturnFormat(ReturnFormat.Tall);
Flags flags = Flags.createFromValue(TagHistoryQueryFlags.BOUNDING_VALUES_YES);
flags.and(TagHistoryQueryFlags.NO_INTERPOLATION);
flags.and(TagHistoryQueryFlags.NO_SCANCLASS_VALIDATION);

context.getTagManager().queryHistory(tagHistoryQueryParams, streamingDatasetWriter);

return only the last value for the specified tag ???
I need to collect all the raw history valuesā€¦

streamingDatasetWriter.getRowCount() = 1

histo.sqlt_data_1_2018_12 for the tag contain 3 values :

29	5				192	1544173333405	2018-12-07 10:02:13.4050
29	10				192	1544173335803	2018-12-07 10:02:15.8030
29	50				192	1544194325530	2018-12-07 15:52:05.5300

I found what was wrong

To obtain all tags changes, it is necessary to add :

tagHistoryQueryParams.setReturnSize(-1);

In the script function system.tag.queryHistory, returnsize has a -1 as parameter default value :wink:

1 Like