LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to set number of lines in a string indicator

Hello,

i am using a string indicator to log messages.

How can i set a number of maximal possible lines? In the attached example it logs forever.

How can i set that ist like a FIFO with 1000 lines?

Thanks

0 Kudos
Message 1 of 11
(2,049 Views)

Hi One,

 

first: don't use a "value" property node, use a shift register instead!

(After being a member of this forum for 16 years you really should know how to use shift registers!)

 

2nd: instead of handling all text in a scalar string you could keep an array of strings in the shift register. Now it becomes very easy to keep the array length at (max) 1000 elements!

(You can use ArrayToSpreadsheetString to convert the array for your strng display…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 11
(2,038 Views)

Hi GerdW,

paying SSP user since 16 years. But the "normal" support line where i pay all the money for is too slow. 😞

 

Is there a function to implememt a FIFO array or do i have to manually remove first index and add new element at the end?

 

And: Does the shift register duplicate the needed memory? First in the shift register and second in the string indicator?

 

Thx

0 Kudos
Message 3 of 11
(2,027 Views)

Hi One,

 


@OnlyOne wrote:

Is there a function to implememt a FIFO array


Yes, there is a "FIFO" function: its called queue!

You can setup a queue of 1000 elements and use LossyEnqueue…

 


@OnlyOne wrote:

do i have to manually remove first index and add new element at the end?


You can do it this way (BuildArray, followed by ArraySubset).

Or you can initialize an array of 1000 elements and use RotateArray & ReplaceArraySubset on it.

 


@OnlyOne wrote:

Does the shift register duplicate the needed memory? First in the shift register and second in the string indicator?


The shift register is the most simple way to keep data without (additional) buffer allocations in one place!

 

The other point is: each indicator uses its own "display buffer". This does not hurt on scalar numerics, but may hurt on large arrays, strings, plots in graphs, etc.

So the "duplicated memory" is due to the indicator, but not due to the shift register. Your "value" property node also requires a buffer allocation as it copies the string content!

 


@OnlyOne wrote:

paying SSP user since 16 years.


Btw. you know you can look for buffer allocations!?

Within 16 years paying for SSP you should have found time to take some of those training courses, which are available through your SSP payment… (I got one year of mostly free training after upgrading my license from "default LabVIEW" to RT+FPGA.)

 

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 11
(2,022 Views)

In general, if you have a string with a bunch of lines and you want to limit it to a certain number of lines, this is how I would go about it. Join Strings.vi and Split String.vi are hidden gems within LabVIEW (not in palettes by default). Many of the gems got packaged into a library on VIPM called "Hidden Gems in vi.lib". Definitely worth installing.

limit lines.png

 

Now put that into a value changed event for String so it can be checked every time it changes.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

Message 5 of 11
(1,947 Views)

Not what you asked for, but maybe you can build off it.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 6 of 11
(1,917 Views)

Paul could you save that in 2017 and zip and share? I am just now getting into X controls and am curious as to what you've got there.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 7 of 11
(1,906 Views)

You would use a shift register and write to string terminal (Which currently sits disconnected elsewhere for unknown reasons. The "text.text" property is definitely wrong because it takes into account the display format. You want the value!)

 

If your lines all have 100% guaranteed the same number of characters, you can easily trim it to a given number of lines. If not, use the above suggestion and keep it in an array of strings (initialized with a fixed number of empty strings where you would rotate and replace with new values as they arrive.

 

It is often more useful to add the newest entry on top of the indicator. No need to keep scrolling to the end.

0 Kudos
Message 8 of 11
(1,890 Views)

Here

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 9 of 11
(1,835 Views)

@paul_cardinale wrote:

Here


Where?

0 Kudos
Message 10 of 11
(1,827 Views)