06-03-2014 11:54 PM
when i get the table of data via shared variable,the moment i click the button "Ok" it opens 25 worksheet of my workbook
what i want is if my table has just 5 rows full of data, the moment i click "Ok" it opens just 5 worksheet of my workbook.
i think it's an indexation related issue.if anyone could help
thanks
Solved! Go to Solution.
06-04-2014 03:53 AM
You are initializing the array with 25 rows so your array will always hold 25 rows of element which includes empty elements also. Why are initializing the array? If you are not doing that, and if you recieve only the required number of rows the your main for loop will iterate number of times equal to the number of rows.
06-04-2014 05:20 AM
if i don' t initialize the array,i will not get data in the other columns of my table.i'm using shared variable,and i found that when i send a row of 25 elements nif i don't initialize the array i get them empty
06-04-2014 01:42 PM
A simple solution to your problem would be to only run your main loop when there is an unempty row. To do this, you would need to put all your code in the for loop in a case structure. Then add an "empty array" conditional statement at the start of each iteration of the for loop which controls the case structure.
Erik S.
06-04-2014 03:22 PM
where do i have to add conditionnal statement exactely
06-05-2014 09:26 AM
Put the case structure and conditional statement inside the for loop. Then, for each row, the conditional will check if that row is empty and if it is not empty, then it will run your code inside the for loop.
Erik S.
06-05-2014 04:46 PM
like that
06-05-2014 04:59 PM
Yes, this is roughly what I was talking about. Test it out and tweak it but that is the general idea.
Erik S.
06-05-2014 05:01 PM
Right click where the array enters the for loop and click "Enable Indexing". This option means that when an array is put into the For Loop the loop will automatically step through the items in the array one at a time rather then you needing to index them using the step count as you would for a while loop. You can also use this functionality for exiting while or for loops to automatically generate an array of the values generated within the loop.
06-05-2014 05:08 PM - edited 06-05-2014 05:10 PM
here is the vi after all the modifications, maybe i missed something