LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple strings and case structure

I want to display each element as a case structure. That is, if the "Data 1" and "Diag Info 1" string has temperature-related information, i want those strings to go into the "temp" case and display two separate indicators - one with the temperature value (1.00 Deg F) and other with the diag info (Temp Alarm 0.27).
Similarly, if the 'data 2" string and the "diag info 2" string show "Gas" then those strings should go into the "Gas" case... and so on. Please see attached file.
0 Kudos
Message 1 of 5
(3,808 Views)
Hello,

I adapted your vi into a new one (attached). I think this is what you want at least as I understand it.
It searches in the Data and the Diag string for "_" and returns the string before it ("Temp") and compares the strings, if they are equal the matching case is executed (otherwise a error message is returned) and the parts you are interessed in are returned to the fornt panel.
If this is not the solution you are seeking please let me know.

Sander
0 Kudos
Message 2 of 5
(3,808 Views)
Hi,

It looks as though you want to parse the "data 1" and use part of the string to index a case statement, then pass the value to it.

Did you really want to have multiple data with special index in each? Or do you have four (4) active data strings and you want to send the data to the appropriate case?

An easy way is to truncate the first 2 or three letters and feed it to the case structure. I would recommend having a default case, typically "0". The identifiers within the case would simply be those first 2 or 3 characters.

In the situation where you have multiple entires, such as Data1... Data4, then, you may have to put them into a loop (while?) and manipulate them in the manner that you want before sending it to the case statements... In this
situation, you would need multiple Case Statements, one for each Datax... but this is unlikely, right?

Let us know more details of how you want the data to be evaluated, is it inparallel, or could you use a single DATA and type in any of the selections, and so on..

Regards,

JLV
Message 3 of 5
(3,808 Views)
Thank you for the response, but I was wondering how I would do it for the other sets of data. That is, I have data 2 and diag info 2 and so on.. Does that mean I have to have individual cases for each set of strings or can I wire more than one set of strings to the same string?

Thanks in advance.
0 Kudos
Message 4 of 5
(3,808 Views)
You cannot wire more than one set a strings to a single case structure.

But, if I understand the problem correctly, I don't see why you need any case statements at all. If your intent is to parse 4 separate results and you need 4 separate indicators, look at the attached example. It For each result, it converts the numeric portion and creates a caption for the numeric indicator. Your diag info is already an indicator so there's no code involved for that.
0 Kudos
Message 5 of 5
(3,808 Views)