Jump to content

Store LV clusters in Database


Recommended Posts

What do XML and INI files have to do with the DB?

If you want to interact with the DB, you usually need to go through ADO (assuming you're on Windows). There are several DB toolkits available for LV, including a paid one from NI and a free one called LabSQL. The NI toolkit has some advantages in that it is supported and that it has built-in code for inserting clusters into DB tables. If you really want, you can recreate this code fairly easily yourself by modifying the OpenG variant configuration VIs or the MGI read-write anything VIs. Also, note that the NI toolkit has a bug which will probably not allow you to use the insert VI without modifying the toolkit code.

Since you only want part of the cluster, however, you're going to have to strip the relevant values out anyway. The easiest is probably to unbundle them, convert them to strings and then build an SQL insert query. Another option would be to flatten the variant to a string, but this will have issues if you plan on changing the value of the variant and will make the data useless in the DB itself.

If you don't know SQL at all, now's the time to start searching for tutorials.

Link to comment

I'm using NI toolkit to interact with DB. Most of time I just execute my own SQL queries and don't use NI toolkit's select or insert or other built in utilities. Sorry, I can not find any built-in code for inserting clusters into DB tables in the NI DB toolkit. OpenG variant configuration looks like what I need to manipulate with cluster's data.

To clarify my question, I'm looking for known and proven DB schemas to store LabVIEW clusters in Database, may be some examples to learn from. Store as key=value list in a string field?

Link to comment

The DB toolkit has a VI called Insert Data which has a variant input. You can input a cluster into that variant and the VI will parse the cluster and insert one element into each column.

This, of course, requires you to model the cluster after the table's structure.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.