LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Connect 2 different text strings to the same case structure

Hi there!

I want to connect different text strings to the same case structure, I researched about it and foun the concatenate strings function. But I dont want to concatenate them I want the words of each string enter the case structure alone. I obtain the words of this strings from different procceses, but I need to enter booth in the same case structure. 

How can I achieve this without concatenation?

 

Thanks!

0 Kudos
Message 1 of 10
(3,413 Views)

Hi kibkib,

 

I need to enter booth in the same case structure.

 

check.png

What's the problem?

 

Do you want to use those strings as input to the case selector? Create an array of strings:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 10
(3,398 Views)

Case structure will match exact strings if you want it to.

if you are worried about upper/lower case then add a 'to uppercase' or 'to lowercase' and ensure all chars in the match are of the correct type.

I believe you can also use a Regex in a case structure - but this would start getting VERY dangerous with strings if you don't know the source and have full control of it.

 

James

CLD; LabVIEW since 8.0, Currently have LabVIEW 2015 SP1, 2018SP1 & 2020 installed
0 Kudos
Message 3 of 10
(3,396 Views)

Yes I want to use both stringsas input for the case selector, I will try using strings as you said.

Thanks!

0 Kudos
Message 4 of 10
(3,385 Views)

I would use a queue to do this. Each process enqueue a string and in the loop that dequeue the data you wire the string data to the case selector. You can even customize the queue datatype to include which process enqueued the data.

 

Ben64

0 Kudos
Message 5 of 10
(3,356 Views)

Im trying what you said, Im using an array with te inputs I need, but when I connect the output of the array to the input of the case structure, appears a feedback node and the wire is broken after the feedback node.

I dont know why the feedback node appears, I only want to connect the output of the array whit the input of the case structure.

What can I do?

hpp.png

You can see the array and the feedback nod on the leftside

0 Kudos
Message 6 of 10
(3,342 Views)

Is the output of VI #2 connected in some manner to the input of the concatenate strings?  The node probably appears because you have the circled option checked.

Capture.PNG

Just delete the feedback node.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 10
(3,333 Views)

Regardless of the feedback node, you can't use an array as the case selector in a case structure. You could put the case structure inside a for loop and have it run once for each string in the array, as GerdW suggested. Do you want to run the case structure twice, first based on the first string, then based on the second string? If not, then please clarify more what behavior you are wanting. Do you mean that if either one of the strings is equal to "AKTIBA" then you want to run that case? If so, you could just compare the strings using Equals and then Or to check for either one of them being equal.

0 Kudos
Message 8 of 10
(3,327 Views)

Yes I want to run the case structure first based on the first string and at the end of the procces there are two options, finish the procces or begin again from the case structure. Our choice of this option is in the second string.

I cant compare them because in the first string the word to recognise is AKTIBA and in the second string there are other words.

0 Kudos
Message 9 of 10
(3,322 Views)

It sounds like you want to perform some operation, for each item selection...so use a FOR loop to process each item selection one at a time.  This is as others have mentioned by having a 1D array of string where each element in the array is an action you want to take.  Perform auto indexing into the for loop, and have your case structure in that loop working on each element of the array one at a time.

0 Kudos
Message 10 of 10
(3,314 Views)