Showing results for 
Search instead for 
Did you mean: 

How to change the number of items displayed on the screen based on user input

Hi everyone,


I am doing a very similar thing as asked in the title post.


I have an array of numeric controls, whose 'number of rows' I set through a separate single numeric control. So far so good.


But the newly created numeric controls are not initialized with zeros etc, therefore, the next code in line freaks out. It doesn't have any outouts from those newly created rows.


I would like to add these number of rows AND at the same time, put zeros to them as well.


Would appreciate any help.



0 Kudos
Message 11 of 17
How are you initializing the array now? The function called Initialize Array would seem the obvious choice.
0 Kudos
Message 12 of 17

The number of visible rows is cosmetic, and has nothing to do with the array size. You need to make sure that the array is resized accordingly. Or you could make the size same as the max number of rows you'll ever need from the beginning.

0 Kudos
Message 13 of 17

Hi Dennis_Knutson & altenbach,


Thanks for looking at my question.


I was so close to the answer, yet so far. You have helped me go get it.


As Denis suggested, I was indeed trying to initialize, and as altenbach pointed out, I realized that the rows being added are just being made visible and not appended to the dimention of the array.


My hurdle was that after initializing the arrays, I get an output array which can only be an indiciator, but I needed an array of controls. 


So, just now I used the property node 'Value' and fed it to the output terminal of 'Resize array' and it works.


Problem solved.


Thanks & Regards


PS: The initialization if achieved using 'Initialize array' kept on forcing zeros forever, even when I modified entries in the controls later on.

0 Kudos
Message 14 of 17

Hi guys,


I guess I was a little fast in replying.


Please find attached a vi utlilizing both the ideas respectively, i.e. Initialize array and Reshape Array functions.


While the Reshape function works, populating all cells with zeros, I would rather have it populate with anything other than zero. Because my code down the line freaks out with zeros.


The Intialize function allows me to put any number other than zero, but then it keeps on forcing that number, even if I change it manually.


Please check the vi and let me know what I am missing here.


Kind Regards

0 Kudos
Message 15 of 17

Well, you would initialzie a 2D array of the desired size and with the desired default value, then replace the original array at position 0,0.



Message 16 of 17

Thanks altenbach,


That's what makes it work.



0 Kudos
Message 17 of 17