LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

database array

I created a simple database array. It got cluster controls showing name, age and martial status. But I need to write these data into a xls file and I can't add new data. With bundle by name function I can only change some data but I can't add new one.

0 Kudos
Message 1 of 8
(2,962 Views)

Hi imbadmini,

 

Since you are using "Replace Array subset" function, you are only able to change the data but not able to add. Use "Insert into Array" to insert or add new data.I just tried to add element at the last so passed the array size as index. You also can pass any intermediate value to insert.

______________________________________________
Kudos are welcome
0 Kudos
Message 2 of 8
(2,950 Views)

Thanks for reply.

Indeed what am I trying to do is to enter a new name in the "new name control" and see it as a new element in the array. However, array size gives a very big number like "8401".

 

 

0 Kudos
Message 3 of 8
(2,934 Views)

Hi,

 

I have significantly improved your code and attached the VI with this reply.

 

1) you have used cluster inside cluster unnecessarily thus made it more complicated. I have simplified it using a single cluster inside an array.

 

2) Used same cluster to input the data. If you make this type def, you can modify and add more functionality.

 

3) Used case structure and used enum to control the new data addition or modifying the data. 

 

Also you can create the item index and control enum into one single cluster for simplicity.

 

Please Kudos if you like my solution.

 

Kind Regards,

Ram Gurung

Certified LabVIEW Associate Developer

LabVIEW_Cert_Asso_Developer.jpg

 

HTML tutorial  HTML tutorial
162+ CLDs & 10 CLAs Trained
LabVIEW Training resources
Message 4 of 8
(2,930 Views)

Can you send an image for this because my version is 8.5

0 Kudos
Message 5 of 8
(2,922 Views)

Hi,

I have attached the snapshots for the front panel and all codes.

Kind Regards

Ram Gurung

HTML tutorial  HTML tutorial
162+ CLDs & 10 CLAs Trained
LabVIEW Training resources
Download All
0 Kudos
Message 6 of 8
(2,909 Views)

If this is to be a subVI of a larger program, you need to set up the connector pane.  You also need an output indicator for the Database Array.  You cannot pass the control to the output.  Generally the use of local variables should be minimized in LabVIEW.  If this is not a subVI, then you need to add a while loop around the code.  Do NOT use Run Continuously! It is only for debugging purposes.

 

You do not need the unbundle and bundle nodes since you are setting the entire New Data cluster.

 

You should make the New Data cluster a typedef so that when you make changes such as adding an address field, you only need to change it one place.  Use the typedef cluster as the element in the Database Array also.

 

If you do not care where the new data is placed in the Database Array, and generally a database does not care, then just use Build Array in the New Data Case.

 

Here is a modified version with these changes.

 

Lynn

Download All
Message 7 of 8
(2,895 Views)

I am getting an error about the selector. How can I solve this ?

 

I am sorry I solved it.

Here is the version of 8.5, I hope I didn't miss any point. When I enter "new name" cluster and hit run, Database Array gives a new member.

0 Kudos
Message 8 of 8
(2,872 Views)