Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
How we get history data in batches
October 1, 2015
6:22, EEST
Avatar
jijomonac
Member
Members
Forum Posts: 18
Member Since:
September 24, 2015
sp_UserOfflineSmall Offline

We want to get history data in batches, for that we set numValuesPerNode =10; But its not working, It returns entire Data

UnsignedInteger batchsize=new UnsignedInteger(10);
DataValue[] result = client.historyReadRaw(nodeId,
DateTime.MIN_VALUE, DateTime.currentTime(),
UnsignedInteger.ONE, true, null, TimestampsToReturn.Source);

October 1, 2015
8:45, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1010
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Yes, that is true. The current implementation fetches the data in batches automatically and provides the data as a whole, when ready.

historyRead() is the raw interface for calling the service with your own parameters and doing it in batches on your own code.

This is the internal implementation:

HistoryReadDetails details = new ReadRawModifiedDetails(false,
startTime, endTime, numValuesPerNode, returnBounds);
return historyReadAll(nodeId, indexRange, timestampsToReturn, details);

where

private DataValue[] historyReadAll(NodeId nodeId, NumericRange indexRange,
TimestampsToReturn timestampsToReturn, HistoryReadDetails details)
throws ServiceException, StatusException,
DecodingException {
HistoryReadValueId id = new HistoryReadValueId();
id.setNodeId(nodeId);
if (indexRange != null)
id.setIndexRange(indexRange.toString());
List<DataValue> dataList = null;
HistoryData data;
byte[] continuationPoint;
// While continuationPoints returned
do {
HistoryReadResult[] results = historyRead(details,
timestampsToReturn, false, id);
checkOperationResult(results[0].getStatusCode());
if (results[0].getStatusCode().getValue()
.equals(StatusCodes.Good_NoData))
break;
ExtensionObject historyDataObject = results[0].getHistoryData();
if (historyDataObject == null)
break;
data = historyDataObject.decode(client.getEncoderContext());
continuationPoint = results[0].getContinuationPoint();
if ((continuationPoint == null) && (dataList == null))
return data.getDataValues();
if (dataList == null)
dataList = new ArrayList<DataValue>();
dataList.addAll(Arrays.asList(data.getDataValues()));
id.setContinuationPoint(continuationPoint);
if ((data.getDataValues().length == 0)
&& (continuationPoint != null)) {
logger.info(
"historyReadAll: Received empty HistoryData with continuationPoint");
break;
} else
logger.debug("historyReadAll: got {} values",
data.getDataValues().length);
} while (continuationPoint != null);

return dataList == null ? new DataValue[0]
: dataList.toArray(new DataValue[dataList.size()]);
}

October 1, 2015
12:32, EEST
Avatar
jijomonac
Member
Members
Forum Posts: 18
Member Since:
September 24, 2015
sp_UserOfflineSmall Offline

thank You!

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
24 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 683

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

digitechroshni, LouieWreve, Kickbiche, karrimacvitie5, graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma

Moderators: Jouni Aro: 1010, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1