LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simple way to append a new row to the end of a list?

Hi.

 

I often use multicolumn lists to display some kind of logging data.

 

I always do it this way:

  1. Read the entire content of the list with the "ItemNames" property (read)
  2. Append the a row to the end of the array with the "Insert Into Array" or "Build Array" function
  3.  Write the new array back into the list with the "ItemNames" property (write)

Is there any easier way to do this?

For example, why isn't there an Invoke Node for (multicolumn) lists called "InsertItemName"?

0 Kudos
Message 1 of 5
(2,289 Views)

You may want to consider a new paradigm.  Controls and indicators are meant for just that, not for holding data.  Using them as data buffers usually gets you into some sort of issue like the one you are describing (and they slow your code down a lot).  A better solution would be to buffer your string arrays internally in a shift register, data value reference, or action engine and only write the strings to the display which you are actually viewing.  This will require hiding the listbox scroll and adding an explicit one which controls your data through an event structure.  This will require some work, but can also speed things up quite a bit (particularly if you have lots of data).

 

Alternately, if performance is acceptable, you can read the control strings, append your data and write.  Much easier.

0 Kudos
Message 2 of 5
(2,274 Views)

"...you can read the control strings, append your data and write".

That's what I do, isn't it?

 

And regarding your other solution(s) - I was asking for a more simple way to append data than read->append->write.

Maybe I should suggest an "AddItemName" invoke node for lists on the LabView Idea Exchange page. 

0 Kudos
Message 3 of 5
(2,269 Views)

What Gray means is that you should keep the data in a wire, not in the control. Thus if you want to add a row you do a build array on that wire instead of the property.

Apart from that there's no easier way than what you're doing with Read property, Build array, Write property. Properties, however, are very slow in comparison so if you can avoid the Read property by keeping the data/list in a wire you'll save memory, gain performance and in general have a better structure in programming LV. 🙂

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 5
(2,258 Views)

I "inherited" a program that used numerous property nodes in just the manner you describe.  After many months of reading these forums, I changed the program to use shift registers to store the data and only retained the multicolumn listbox to display the data as DFGray suggests here.  Because I didn't want a bunch of wires running across the main diagram, I use functional globals (e.g., shift registers on a single-iteration while loop in a sub-VI).  Now the only wire that runs across the diagram is the error cluster, which is helpful for other reasons. 

 

Regards,

 

Michael Tracy

Synergy Microwave

 

Message 5 of 5
(2,254 Views)