Log Any LabVIEW data to CSV File or SQLite DB

Home / Blogs / Log Any LabVIEW data to CSV File or SQLite DB

Have you ever tried to log your LabVIEW data to CSV or SQLite?  While logging your data from LabVIEW to a CSV/SQLite database, have you ever wanted to avoid the daunting job of creating the DB schema or creating the CSV headers for logging?  How daunting is the job of converting the LabVIEW data to CSV strings or SQLite data types?  We use to spend a lot of time for that.  Isn’t it?

Here is a tool which I have created recently can ease this logging activity in LabVIEW.  This is simple table logger which logs all your data to only one table (Yes! even your array data will be logged in the same table with other data).

All you need to do is wire your LabVIEW data to the two different VIs.

  1. Wire your data to LAUNCHER for creating the CSV headers (or SQLite DB column headers) from your LabVIEW data structure.
  2. Wire your data to INSERT message in order to log the actual data.  Oh..! I forgot to tell that it’s an actor; and that’s why it’s a message.!

    Fig. VI snippet of example VI which logs any LabVIEW data
  3. Don’t forget to send normal stop message to the actor in order to stop it at the end of your application.

After running the above example, the CSV and SQLite data logged as shown below.  Check that LVData cluster in the above snippet is logged as data with headers from the element names of that cluster.

Fig. Log Any LabVIEW data – CSV Log of the example.

 

Fig. Log Any LabVIEW data – SQLite Log of the example.

 

Check out that schema (types and table names) for the SQLite DB is automatically created below.  See how the array data is spitted into different columns yet it logs in single table.

Fig. Log Any LabVIEW data – SQLite Headers

 

So why is it actor?  You may have this question in mind.  I made is actor simply because I wanted to do something on actor.  More importantly, the logging can happen in parallel (actor) loop so that your main application don’t wait for logging to finish.

The source of this tool is open in GitHub and I invite you to contribute.

GitHub: https://github.com/digiajay/LogAnyLabVIEWdata
Source Version: LabVIEW 2014
Dependencies: OpenG Libraries – OpenG Toolkit , SQLite Library for LabVIEW by Dr. James Powell

Ajay is a professional developer and architect of LabVIEW applications with extreme interest in getting the hardware connected to LabVIEW and automate the stuffs.  He is also a good mentor for the various interns in his career.  He is ready to help the people in techie roles.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: