Author Topic: Set Range for Date and Time and download csv file within the range  (Read 1251 times)

msdavid

  • Newbie
  • *
  • Posts: 5
    • View Profile
Set Range for Date and Time and download csv file within the range
« on: September 08, 2020, 10:35:57 AM »
Hello everyone,
 I am kinda of new to Advanced HMI software, I am loving this software so far. I am working on the project where I nead to select start date time and end date time and should download the data in csv within that range only.. So plesase please help me regarding this problem trying so hard on the internet for the solution baut not getting anything..
 thanks in advance..

MajorFault

  • Guest
Re: Set Range for Date and Time and download csv file within the range
« Reply #1 on: September 08, 2020, 12:02:30 PM »
What data?  Database, dataset, table, flat file, etc.?

msdavid

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Set Range for Date and Time and download csv file within the range
« Reply #2 on: September 15, 2020, 06:09:11 PM »
This kind of data. When we use BasicDtataLogger2, the data start to getting stored in .log file automatically. But I want to set range of time date, etc. and download the csv or .log file which contains data within that range of date and time only..

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: Set Range for Date and Time and download csv file within the range
« Reply #3 on: September 15, 2020, 09:33:12 PM »
Add a timer to your form, enable it, set its interval to what you want (maybe 1000 ms).
Set: BasicDataLogger21.EnableLogging = False

Double click the timer to enter its Tick event and add your code to check the current date/time, compare it to the date/time you want and then start the logging with:

    BasicDataLogger21.EnableLogging = True

Then check the date/time again and stop the logging:

    BasicDataLogger21.EnableLogging = False
« Last Edit: September 15, 2020, 09:45:22 PM by Godra »

msdavid

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Set Range for Date and Time and download csv file within the range
« Reply #4 on: September 16, 2020, 02:38:09 PM »
Thanks Godra for your reply. Really appreciate it.
But I had question,
How do I access the backend data??
« Last Edit: September 16, 2020, 02:40:41 PM by msdavid »

MrPike

  • Sr. Member
  • ****
  • Posts: 297
    • View Profile
Re: Set Range for Date and Time and download csv file within the range
« Reply #5 on: September 16, 2020, 04:23:15 PM »
It sounds like you want to retrieve historical data using a date and time filter. Godra’s solution is good if you are looking for current data since the timer was started.  If you want historical data then you probably need to go with storing it to a DB and then retrieving it from there.

msdavid

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Set Range for Date and Time and download csv file within the range
« Reply #6 on: September 17, 2020, 11:10:47 AM »
Thanks MrPike for the reply.
Yeah, I want to retrieve the data within a range of date and time from the historical data which will be stored in local drive when we use BasicDataLogger. So basically what I want is when user will enter the start date time and end date time, then the data within that date time range is to be retrieved. I don't know how to do it. Any help is appreciated.

MajorFault

  • Guest
Re: Set Range for Date and Time and download csv file within the range
« Reply #7 on: September 17, 2020, 02:43:30 PM »
I recommend SQLite, a user has posted an example on this very forum...
https://www.advancedhmi.com/forum/index.php?topic=2607.msg15649#msg15649

Using a database is very common and not solely related to AdvancedHMI.  There are tons of information out there.  Search Google...
Some examples:
https://www.youtube.com/watch?v=t6j1T-5hqL4&ab_channel=EasyApp
https://www.codeproject.com/Articles/1210189/Using-SQLite-in-Csharp-VB-Net
https://www.youtube.com/watch?v=vzrE94oGXBs&ab_channel=iBasskung
https://www.youtube.com/watch?v=UN7nMNVw2hk&ab_channel=CodingWithAndrew

Some of the those examples may not apply, but I found those examples in about 15 seconds. 

Godra

  • Hero Member
  • *****
  • Posts: 1438
    • View Profile
Re: Set Range for Date and Time and download csv file within the range
« Reply #8 on: September 17, 2020, 06:10:47 PM »
There is an old charting app that allows selecting date and time from the log created by the BasicDataLogger:

  https://www.advancedhmi.com/forum/index.php?topic=571.0

It hasn't been updated in quite a while and if you are to use it then don't expect to get support for it.

Your time might be better spent learning how to use database.