LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can i limit the number of lines in a string-indicator?

Hello,
i´m using a string indicator as a logging-field which gets from time to time a new line.
The question is now: How can i limit the number of lines in this indiciator for example to 1000 lines so that when the line 1001 is inserted that the first line is going away?
(And: How many lines can a string-indicator have?)

Thanks for your help
0 Kudos
Message 1 of 3
(2,885 Views)
This is not that easy, because your lines can have variable number of characters and could range from a single linefeed to a huge number of characters. You could maintain your data in an array of strings, one element per line.
 
If all your lines have fixed lenght, you could just calculate the string subsets to keep and things will be a bit easier. Still this will be a lot of data shuffling.
 
Maybe you could also keep a helper integer array that keeps track of the characters/line. This will also let you calculate how to truncate whenever a line needs to be discarded.
 
There are many ways to optimize that. You could also simply stream to disk and read a few lines back into an indicator. Use a scroll control to read back earlier data. This would eliminate having thousands of lines in an indicator.
 
 
0 Kudos
Message 2 of 3
(2,880 Views)
Those were good suggestions from altenbach. Another mechanism you may want to look at is a queue. I wrote a memory logger utility that does essentially what you're trying to do using a queue. (And before you ask, no I can't send it to you since it's company code. Smiley Sad)
0 Kudos
Message 3 of 3
(2,860 Views)