logSeek (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

1.00 / 1.00.00


logSeek will move the current read position a number of records forward/backward (in time) in the Datalogger. It is possible to specify a specific tag value and the number of rows, and whether the search should be forward or backward in time. If the tag value is specified, the function will move the current read position"'n" a number of records with the specified tag value in the specified direction. If no tag value is specified, the current read position will just move "n" number of rows - regardless of the tag values of the rows. The direction of the search is given by the sign of "n". If it is positive, the search will be forward in time, if it is negative, the search will be backwards.

 

Please note:

The search will start at the next record in the specified direction. This means that in case the tag value of the current record is the same as specified in logSeek(), this record will not be returned. This is especially important when using logLast() / logFirst().

 

Note for multithreading application:

There is only 1 global read-pointer available for each Datalogger which means that several threads navigating the Datalogger should implement critical sections to avoid problems.

 

 

Input:

tag : INT

Which tag value to search for. -1 indicates that no tag value is specified.

 

n : INT

Number of rows to move. If positive, the search will be forward, if negative, the search will be backwards.

 

handle : SYSHANDLE

A handle to the Datalogger to navigate. If not provided, it will work on the flash-based log. Only supported on NX32L with firmware 1.50.00 or newer.

 

Returns: INT

Number of records actually moved (maintains the sign of "n").

 

Declaration:

FUNCTION logSeek : INT;
VAR_INPUT
  tag   : INT := -1; | Tagvalue to search for (-1 seeks without using a specific tagvalue).
  n     : INT;       | Number of rows to move
  handle : SYSHANDLE;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
 
BEGIN
  ...
  // Position readpointer to the first (oldest) record in the Datalogger
  logFirst();
  // Move 5 records forward on tagvalue 12
  logSeek(tag:=12, n:=5);
  ...
END;
 
END_PROGRAM;