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.
- Wire your data to LAUNCHER for creating the CSV headers (or SQLite DB column headers) from your LabVIEW data structure.
- 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.!
- 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.
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.
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.
Ajay is a professional developer and architect of NI-LabVIEW applications with extreme interest in getting the hardware connected to LabVIEW and automating the stuff. Recently he is also putting his hands in NI-TestStand to get very dirty on it. He is also a good mentor for the various interns in his career. He is ready to help the people in techie roles.