Jump to content

Adding diffrent data type arrays to a table


Recommended Posts

hello :book:

so here's the deal... i am upgrading an existing VI that saves into spreadsheets to be database mastered!

i am using labview 7.x and visual foxpro :worship: free tables *.dbf files & an ocx control that i developed that reads/writes to a database... but this is another story hehe :headbang:

my problem is that i have three 1D arrays:

Array number 1: a string array, lets say for example (sensor names) ===> data type: string

Array number 1: a numeric array, lets say for expamle (sensor number) ===> data type: numeric

Array number 3: a color box array, lets say for example (sensor color) ===> data type: color box

i want to take these three arrays & put them in the database table lets say sensor_description this way:

field 1: sen_name field 2: sen_num field 3: sen_color

the problem is you can't combine an array of different data types :wacko:

Also i tried so many ways to insert even one array it doesn't accept except to fill the whole record in the table.

i need a way to move with these data to obtain a 1D array that i can give to the control that will fill the table.

Link to comment

QUOTE (raymyster @ Sep 26 2008, 12:13 PM)

i want to take these three arrays & put them in the database table lets say sensor_description this way:

field 1: sen_name field 2: sen_num field 3: sen_color

the problem is you can't combine an array of different data types :wacko:

Have you looked into clusters? You can create a cluster of these 3 elements and then create an array of clusters...

EDIT: Doh! Too slow.

Link to comment

QUOTE (raymyster @ Sep 26 2008, 12:13 PM)

my problem is that i have three 1D arrays:

Array number 1: a string array, lets say for example (sensor names) ===> data type: string

Array number 1: a numeric array, lets say for expamle (sensor number) ===> data type: numeric

Array number 3: a color box array, lets say for example (sensor color) ===> data type: color box

i want to take these three arrays & put them in the database table lets say sensor_description this way:

field 1: sen_name field 2: sen_num field 3: sen_color

the problem is you can't combine an array of different data types :wacko:

I recommend making a typedef cluster of one of each type. Then you should start to make individual VIs which can format this for a table, or for your database, or for display. Then you make your arrays into an array of these clusters, and you can just call your VIs in a loop. (If it needs to be fast, you can rethink whether the loop is inside or outside the subvi).

In an object-oriented world, this typedef is your class object, and it represents your real-world sensor object, and then your set of VIs which work on this class is your set of methods. Even if you don't use lvclasses for this (I probably wouldn't bother), thinking about your code like this will probably make your design better.

Link to comment

QUOTE (raymyster @ Sep 26 2008, 03:13 PM)

Hi Raymyster

You can combine different datatypes into a cluster and then make an array of that cluster.

post-10515-1222457974.png?width=400

QUOTE (raymyster @ Sep 26 2008, 03:13 PM)

I would suggest you take a look at the Type Sensitive Popup code from JDave in the Code Repository. You can use this tool to initialize a table with different kinds of datatypes. It's not exactly a plug-n-play solution for your problem, but it shows how you can achieve what you want by playing with Multicolum listbox properties.

QUOTE (TobyD @ Sep 26 2008, 03:35 PM)

EDIT:
Doh! Too slow.

EDIT: DOH! Re-DOH! Way too slow. :)

Link to comment
  • 3 weeks later...

well guys the cluster wont do anything i can't make the control accept a cluster, its a weird data type restrained to labview :P its like an array of objects or somthing :P anyway i will have to re-edit my ocx control to take many inputs at a time thats the easiest thing i can think of.

i dont think creating an ADO tuned toolkit is slow ;)

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.