raymyster Posted September 27, 2008 Report Share Posted September 27, 2008 hello 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 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. Quote Link to comment
TobyD Posted September 27, 2008 Report Share Posted September 27, 2008 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 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. Quote Link to comment
jdunham Posted September 27, 2008 Report Share Posted September 27, 2008 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 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. Quote Link to comment
Francois Normandin Posted September 27, 2008 Report Share Posted September 27, 2008 QUOTE (raymyster @ Sep 26 2008, 03: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 Hi Raymyster You can combine different datatypes into a cluster and then make an array of that cluster. QUOTE (raymyster @ Sep 26 2008, 03:13 PM) 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. 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. Quote Link to comment
raymyster Posted October 14, 2008 Author Report Share Posted October 14, 2008 well guys the cluster wont do anything i can't make the control accept a cluster, its a weird data type restrained to labview its like an array of objects or somthing 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 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.