Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

way to overwrite actual record in a datatable?


Chasper B. Mar 20, 2023 01:16 PM

Hi all, dear Campbell-support

I have an average-instruction in a datatable (in a program for a CR1000). To avoid a NAN only because of one faulty measurement during the tables interval, I disable the processing of the average with the DisableVar-flag, this works well. But when it’s disabled during the whole interval, a NAN is still recorded. I want to overwrite this NAN with a specific error-value.

I tried to check the record immediately after the calltable by accessing it with the TableName.FieldName syntax. Then in case of a NAN, to call the table again with the average enabled and the desired value in the corresponding variable. - As it seems, with TableName.FieldName it doesn’t read the immediate written record, but the former one.

So, is it possible to check the immediate recorded value in the same scan (with the same timestamp), to be able to overwrite it?

Or is there another way to know if the average was not processed during the whole interval? Respectively to get the intermediate value of the average instruction? - Otherwise, I have to monitor the DisableVar-flag during the whole interval.

       '+++   call the datatables, store the values   ++++++++++++++++++++++++++++++++
    CallTable TableName_Meteo        'save/process the measured and recorded data in
    CallTable TableName_Service      '  the corresponding tables

    If TableName_Meteo.WindSpeedScalMean = NaN OR TableName_Meteo.RelativeHumidity = NaN OR TableName_Meteo.TemperatureAir = NaN Then
      Young_disableTableProcess = False        'nevertheless process the "error"-value
      TaRH_disableTableProcess = False         '  into the table, instead of NaNs
      CallTable TableName_Meteo                'overwrite the NaNs in the table with
      CallTable TableName_Service              '  the "error"-values in both tables
    EndIf
  NextScan

Thanks a lot for your help and best Regards, Chasper


JDavis Mar 20, 2023 06:51 PM

I would recommend replacing the NAN value as part of post processing data. The operating system of the datalogger is designed to protect the integrity of logged data. So, by design it is preventing you from changing values already saved in the table.

It is correct that you could monitor the DisableVar flag the whole interval, and swap in a value for the table is written. Note that the floating point variables can only hold INF, NAN, or a number.

One way to replace the value in post processing is with Split. Split is included in Loggernet. There is a bit of a learning curve. The help documentation within the program is pretty thorough. It just takes time to learn when new to the software. In Split, look for the help topic on Range Testing for how to find bad values. In the Output options, there is an option for Bad Data where you can specify a replacement value.


Chasper B. Mar 21, 2023 12:01 PM

Thank you very much for your answer, Jacob. That’s actually a good point, about the protection of the logged data. My aim was to adapt the data before it’s stored definitely, there’s why I thought to read a kind of intermediate result.

As the data is processed directly to a database and there for some reason I don’t know, a specific value instead of a NaN was preferred, I’ll probably still implement the solution with the monitoring of the flag.

Thanks a lot, and have a nice day, Chasper

Log in or register to post/reply in the forum.