LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Find and Replace text in string array constant doesn't work?

Solved!
Go to solution

I'm trying a quick find and replace text within LabVIEW on a few string array constants, attempting to replace a backslash with a forward slash. The search results show a little strikeout icon next to each entry in the array, indicating it can not be replaced.

 

The Replace help states "A strikeout icon appears next to an entry in the Search Results list if LabVIEW cannot replace that instance. For example, you cannot replace the text in a Property Node or an Invoke Node. You also cannot replace text in running VIs." Fair enough, but I don't see why the string array doesn't qualify for text replacement. Am I missing something?

 

find_replace.PNG




Certified LabVIEW Architect
Unless otherwise stated, all code snippets and examples provided
by me are "as is", and are free to use and modify without attribution.
0 Kudos
Message 1 of 9
(4,456 Views)

Hello,

It can only replace a string constant,the "\" you want replace is inside array that's why its showing like that for other 2 elements.

Expand.Evolve.Influence
0 Kudos
Message 2 of 9
(4,440 Views)

Is there a reason why string array constants should be excluded from a text replace though? If I can edit the text by hand surely LabVIEW can do it too.




Certified LabVIEW Architect
Unless otherwise stated, all code snippets and examples provided
by me are "as is", and are free to use and modify without attribution.
0 Kudos
Message 3 of 9
(4,380 Views)

Hello,

 

According to me this is to search text(In find window either you can select Objects OR Text) so that's why it is not allowing to relapse element of a array.

Expand.Evolve.Influence
0 Kudos
Message 4 of 9
(4,372 Views)
Solution
Accepted by topic author MichaelBalzer

So apparently, it's a known bug:

 

https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Allow-Find-and-Replace-text-to-operate-on-string-arra...

 

Kudo-ing the idea might still help a little bit to give it priority.

Message 5 of 9
(4,320 Views)

wiebe@CARYA wrote:

 

Kudo-ing the idea might still help a little bit to give it priority.


Kudo-ing is probably not possible, since it's state is set to "declined".

0 Kudos
Message 6 of 9
(4,292 Views)
Solution
Accepted by topic author MichaelBalzer

You might be aware of this option, but I just suggest a workaround, that you can easily create a VI which can do this search and replace via scripting.

You could even make a quick drop plugin for this as i imagine.

Message 7 of 9
(4,286 Views)

@Blokk wrote:

You might be aware of this option, but I just suggest a workaround, that you can easily create a VI which can do this search and replace via scripting.

You could even make a quick drop plugin for this as i imagine.


In the idea OP mentions "no scripting please!", so he's aware. In this thread it's a very valid remark. Others might read it that are not aware.

 

Scripting this is usually not worth the effort for me. I usually copy the control\constant in a new VI, program the modifications, then paste it back. But for 50 constants that would get annoying fast... Doesn't happen to me that often, guess I usually read those kinds of arrays from file.

0 Kudos
Message 8 of 9
(4,281 Views)

I figured such an oversight was probably a long-standing bug. I ended up writing a script to do this just to check it could be done, though ultimately hand editing the constants was probably quicker. At least NXG has the problem fixed...

 

find_replace_text.PNG

... or not. *sigh* It can't even find text in string arrays.

 

 

 




Certified LabVIEW Architect
Unless otherwise stated, all code snippets and examples provided
by me are "as is", and are free to use and modify without attribution.
0 Kudos
Message 9 of 9
(4,276 Views)