From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding row to MultiColumn Listbox

Solved!
Go to solution

Hi everyone,

 

The topic seems easy but is not ^^'
I have a large amount of data that has to be written in a MultiColumn Listbox and the only way to write data in it, is to use the property node "ItemNames", 2D String array, (as far as I know). So, each time I have to write 1 row, I have to write all the data (~1 000 000 row) and it takes too much time.
I tried to use the property node "Defer Panel Updates" but it doesn't solve my problem.

I attached a test VI where you can see my problem.
My request is simple, I want to add to my multi column listbox 1 row after another instead of all the lines.

 

If you have any ideas let me know.

Thanks and see you soon !

0 Kudos
Message 1 of 9
(3,873 Views)

1 million rows of data inside a frontpanel, that will always be slow, even if you switch to a table. Do you really have to display ALL the data?

 

An idea that might work: Do the scrolling manually with an additional scrollbar and display only a subset of your data inside the frontpanel.

 

Regards, Jens

Kudos are welcome...
0 Kudos
Message 2 of 9
(3,865 Views)

Hey !
Thanks for your answer, I indeed thought about that but it's my ultimate solution.
And yes, I develop a zigbee sniffer and the user has to be able to go back in order to see previous frames...
In my case, the main issue is that the "ItemNames" property node is during >1sec and it delay my others action. At the end I can't even close my app because too many events are waiting to be executed.

I will wait a bit to see if a miracle solution will show up ^^'

0 Kudos
Message 3 of 9
(3,816 Views)
Solution
Accepted by topic author TenJigoku77

@TenJigoku77 wrote:

At the end I can't even close my app because too many events are waiting to be executed.


This one I think I can help with.  In the Edit Properties setting of an Event Structure you can click the checkbox to Limit Maximum Instances of This event in event queue and set it to 1.  This will mean that event can't be enqueued to be processed, if that same event hasn't been handled yet.

 

As for the MCLB, I'd use defer and undefer, and if that still isn't enough, the best I can suggest is a hacky solution using a Virtual MCLB, which basically just shows you a small subset of the data at a time, with a separate scrollbar that shows which set of data is being displayed.  Here is a demo over on LAVA that someone made years ago when the MCLB updating was even slower

 

Oh and maybe you could use a table instead of a MCLB and then updating it is like writing a string to the terminal, but that only works if you don't need to have control over the font, or background color of each cell individually which I assume you do since you selected to use a MCLB in the first place.

0 Kudos
Message 4 of 9
(3,806 Views)

Hey !

 

I can't limit the maximum instance of this event because if I do I'll loose acquired data and I can't allow that.
Defer does not change much (my time gain is around 10% => not enough).
I'll try to look into this virtual MCLB, I never heard of if, I'm curious ^^
For the record I use a MCLB because it was nicer than an array (quicker to settup), but maybe I shall change to an array...

 

[EDIT] I can not download the Virtual MCLB example of the link you gave me. If someone sucessfully got it I'm interested.

 

Anyway thanks for your answers, it give me some ideas.

Best regards,

0 Kudos
Message 5 of 9
(3,772 Views)

If you are acquiring data somewhere, and then pushing it to the MCLB, then I'd suggest not pushing every new sample as they come in, but instead hold them in a queue until you have some amount of data, then add all the new rows at once.  Also if this is the case then I'd also suggest you put an upper bounds on your array size so it doesn't continue to grow consuming all memory of your system.

 

Another option might be to log all data as it comes in, then for display purposes you load in a subset of the data at a time.  Scout is a TDMS file viewer and it has a similar feature with a control that allows for selecting what window of data you look at, at one time.

 

As for the download you need to be logged in.

0 Kudos
Message 6 of 9
(3,707 Views)

Thanks for your suggestions.
I tried many options such as you proposed but in the end it did not work very well.
Putting in queue and waiting to have a lot of data does not change the fact that it takes too many time to display those data on the MCLB.
Instead of using a file as a buffer I reworked my architecture and used an array (it was easier)...no other choice. I customized it so it fit my display need but in the end I could not use this MCLB ^^'
Maybe NI will add this feature "add a row in MCLB" in the future, hope they will.


Anyway thanks for your support, it was productive.
See you again !

0 Kudos
Message 7 of 9
(3,700 Views)

I'm not sure i understood you correctly, but if you just want to add a row to MCLB then use property node --> item names and add new value with insert into array function (or build array) and then write result back to item names property node.

0 Kudos
Message 8 of 9
(3,681 Views)

@AeroSoul wrote:

I'm not sure i understood you correctly, but if you just want to add a row to MCLB then use property node --> item names and add new value with insert into array function (or build array) and then write result back to item names property node.


That is how the OP started. Problem here is, it gets extremly slow, because:

 

1) It is done via a property node which forces LabVIEW to switch to the UI thread and to redraw the front panel

2) generally the MCL gets slow when handling a big amount of data, the OP wants to display about 1 million rows

 

Regards, Jens

Kudos are welcome...
Message 9 of 9
(3,678 Views)