LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

clear array with boolean

hi, i'm having problems with clearing of arrays... currently, my vi works in such a way that i store the required amount of readings into an Array Subset (the Array Subset is inside the Stacked Sequence Structure) using a Insert Into Array... after the amount of readings is reached, it is saved into SQL... this happens when i press the "Save" button (True state in the Case Strucuture... the Stacked Sequence Structure is inside the Case Structure) ... after all the readings r saved into SQL (same Stacked Sequence Structure as Array Subset), the button changes to false (the 2nd state of the Stacked Sequence Structure) to prevent duplication of data inside the database...
 
the problem i'm facing is the Array Subset contains the same readings after the very 1st run... thus when i press the "Save" button again, the same set of data is being saved into database... i've read some past solution and all recommended the use of Shift Registers.. i've tried using it but unsuccessfull... i 1 the Array Subset 2 b cleared when the "Save" button returns to false... so when i press the "Save" button again, it can store data into the array again...
 
any1 can enlighten me?? thanx in advance... Smiley Very Happy
Best Regards,

JQ

LV 8.0 user...
0 Kudos
Message 1 of 14
(9,519 Views)
Hi,

could you post your code so that we can try to find out what's going on ? Smiley Surprised


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 14
(9,508 Views)

i would like 2... but there r simply to many files... lol... there r many sub vi attached 2 it... so i'm not sure if u can open it... mayb i can simplify the problem n hope u can visualise it.. hahaha...

ok... the main problem is i need 2 clear my loop when the button returns to false so that the array wont remain the same... if not i'll b saving the same data all the time... i wont get the latest update when i press the button... i understand from other post that shift register is needed 4 it 2 work... can u teach me how does this shift register work?? and is it possible 2 directly clear the data in the Array Subset that stored all my data??

thanx 4 helping out... Smiley Very Happy

Best Regards,

JQ

LV 8.0 user...
0 Kudos
Message 3 of 14
(9,499 Views)
Hope this vi helps
Message 4 of 14
(9,488 Views)
Ok,

Maybe you could post a screen shot of your code then ?

There are different way to do it and the appropriate way depends of your architecture... If I understand well, after saving your data, you need to empty the array in order not to duplicate data, if this is it you should empty the array right after saving the data and not waitnig a boolean to be clicked. To empty your array, maybe a local variable in "write mode" with an empty array linked to it ; or if the array has no terminal (data is just in a shift register), then link a empty array in the shit register.

Again, it is hard to give a good advice without seeing your architecture.
Hope this helps anyway...

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

Message 5 of 14
(9,490 Views)
ok... thanx 4 the example.. i'll test it out tml @ work... no labview @ home.. lol...
 
titou... u gave me some help... i'll try the example out n if still doesnt fit my environment, i'll try 2 take a screenshot of it tml...
 
thanx 4 all ur help... Smiley Very Happy
Best Regards,

JQ

LV 8.0 user...
0 Kudos
Message 6 of 14
(9,481 Views)
By the way - this is not a chat room but a serious forum. I'd suggest you to write properly, because there are lots of different people from all over the world. They may not understand you.
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
Message 7 of 14
(9,473 Views)
Maybe he should try Esperanto, the supposedly "international" constructed language. Smiley Very Happy
0 Kudos
Message 8 of 14
(9,440 Views)

devchander:

sorry.. i am unable to open the vi as i am using 8.0... the example you gave me is in 8.2... anyway, still thanks for the help... Smiley Very Happy

titou:

i've attached a screenshot of my vi... its rather messy.. hope you don't mind... i've added some comments to make it clearer too... hope it helps... anyway, just a brief of what i want to do... retrieve reading from sensor, loop through a single channel (for the time being 1 channel is enough...) to get the readings of all the sensors available.. put them all into an array and add them into SQL... on the right side is the calculation of the readings (dont need to bother about it..) gotten from the left array ... after that it'll be saved into another SQL table... after that the button will return to false... and when i press it again, the process will repeat... the problem i found out is from the top left hand loop... after saving the required data, it doesnt clear... so when i press the save button the second time, it adds on to the array (Example, first loops retrieves 250 readings... when i press the save button the second time, instead of starting from 0, it starts from 250.. making the size 500 instead of the intented 250...)... making it pass a false value on the bottom Case Structure (it only becomes true when the array size is 250, according to the example i said above)... thanks for all your time Smiley Very Happy... sorry for posting so late Smiley Sad...

becktho:

point taken note... i'll use proper english in this forum... sorry for any inconvenience caused...

Best Regards,

JQ

LV 8.0 user...
0 Kudos
Message 9 of 14
(9,414 Views)
In LabVIEW 8.0
Hope it helps
Message 10 of 14
(9,399 Views)