AdvancedHMI Software

General Category => Support Questions => Topic started by: bkane on February 28, 2018, 02:34:04 PM

Title: Basic Data Logger 2
Post by: bkane on February 28, 2018, 02:34:04 PM
Hello

I am attempting to use the data logger 2 to write multiple values to a .csv file. I read in a previous forum post that the data can be separated into different columns using the prefix function. Does this mean I will have to use multiple data loggers for multiple outputs to put them in different columns? Or is there a way to do this using the collection function on the basic data logger 2? Also, sorry for the loaded post, but is there a way to create new .csv files every run? Or will the data logger overwrite the previous file every run?

Thanks
Title: Re: Basic Data Logger 2
Post by: Archie on February 28, 2018, 05:33:38 PM
The BasicDatalogger2 will log the value of the items listed in PLCAddressValueItems to the log file as comma separated values.
Title: Re: Basic Data Logger 2
Post by: bkane on February 28, 2018, 05:37:17 PM
I was just going to reply to myself that I figured out what I was doing wrong. Thanks though.

But I still need to figure out how to stop writing to one .csv file and to create another one. For example, I want the logger to write to a different file every 24 hours or when I click a button. Is this at all possible?
Title: Re: Basic Data Logger 2
Post by: NewControls on March 02, 2018, 09:39:38 AM
This is the way i have done that before, just take the "HH-mm" out of the code to make it store to a new file everyday.

Note that this time is coming from the PC this program is running on.

Code: [Select]
    Private Sub BasicDataLogger1_DataChanged(sender As Object, e As Drivers.Common.PlcComEventArgs) Handles BasicDataLogger1.DataChanged

        Dim logstamp As String = ".log"
        Dim timeStamp As String = DateTime.Now.ToString("yy-MM-dd-hh-mm")
        Dim Stamp As String

        Stamp = timeStamp & logstamp

        BasicDataLogger2.FileName = Stamp

    End Sub