07-17-2017 05:18 AM
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!
07-17-2017 05:42 AM - edited 07-17-2017 05:48 AM
07-17-2017 05:45 AM
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
07-17-2017 06:05 AM
Yes I want to use both stringsas input for the case selector, I will try using strings as you said.
Thanks!
07-17-2017 08:05 AM
07-17-2017 10:05 AM
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?
You can see the array and the feedback nod on the leftside
07-17-2017 11:43 AM - edited 07-17-2017 11:44 AM
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.
Just delete the feedback node.
07-17-2017 12:09 PM
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.
07-17-2017 12:49 PM
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.
07-17-2017 02:05 PM
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.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord