1 Reply Latest reply on Feb 21, 2018 2:55 PM by gmichaud-verreault

    odbc auto recovery

    Hans_Drost

      Hello PI square,

       

      I am working on an ODBC interface with IP21.

      For this connection, we have 2 functions available on the IP21 side:

      - Get_Values(tagname, begin_time(optional), end_time(optional))

      - Get_values_all()

       

      The first function can give back a certain time range from the IP21 tag values, where as the second function gives back the current values of all tags.

      Both functions work correct for current values. I use a distribution tag for the second function and a variable for the second function (P1=AT.TAG for each tag, no start/end time).

       

      I would like to have some sort of "auto recovery" type of implementation.

      I thought this would work with the Recovery Parameters recovery mode "TimeStamp". Setting one of the tags that has the highest scanclass as the timestamp tag.

      This should, as far as I understood, get the timestamp of the last value from that tag and fill a variable (TS) in the first functions begin_time.

      It seems that this does not work that way. It wants a datetime tag, which I can fill with a analytics by getting the latest timestamp of one of the tags.

       

      Is this how I should go about this, or is there a different "better" way of solving this?

       

      Kind regards,

       

      Hans Drost

        • Re: odbc auto recovery
          gmichaud-verreault

          When using the RDBMS (ODBC) interface, you can take advantage of placeholders - see UserGuide - to pass different timestamps when running history recovery.

           

          Typically, the interface performs data recovery during startup (offline mode), before it begins its normal data collection (online mode). In addition, you can run the interface in pure replication mode, specifying the time period for which you want to recover data (History Recovery Only mode). In pure replication mode, the interface scans the source for data from the specified time period, updates the target by executing the queries that you define, then exits.

           

          When running in history recovery, placeholders will be replaced by the time passed by the history recovery. For example, if you are performing history recovery from 01-FEB-2018 to 05-FEB-2018, with a 1d step, it would pass 01-FEB-2018 for TS, then 02-FEB-2018, all the way to the 05-FEB-2018.

          You can then use P1=TS in the tag configuration and pass the placeholder in the query: Get_Values(tagname, ?, end_time(optional))

           

          Gabriel