04-11-2011 02:48 AM
Hi,
I try to configure a case structure in a way that one case matches all the input strings started with "CurrentMeasurement" (and others.)
This results TRUE, if the input = "CurrentMt" and also TRUE if input = "Currenteasurement". But FALSE for "CurrentMeasuremen"
So what is the rule? In the help I find only hints for string ranges, for example stringe begin with a and b should be "a..c"
But my basic problem is that I could have too many strings in the case selector label, so that they won´t be displayed completely, just a section of them. i.e the selector label contains 20 strings, all are 30 characters long. If you navigate with the mouse cursor to the selector label, a single line will be displayed, and all the strings not fitting on the screen, will be simply truncated.
regards
Mitulatbati
Mitulatbati
04-11-2011 03:18 AM
Hi Mitulatbati,
some rules of thumb:
- use Enums for case selector issues
- use a "pre-stage" case structure: check for all those strings in a first case structure with only one string per case. The output of that structure then triggers the second case structure to make the "real" decisions...
- use StringMatching/StringParsing/RegEx functions to check for ranges of string inputs
04-11-2011 03:23 AM
GerdW got there quicker than me, however I'd got as far as typing this lot out and attaching the vi, so I thought I'd post it. It is basically along the lines of GerdW's suggestions.
As far as I'm aware, the case structure won't do this level of string formatting for you (maybe its something for the idea exchange).
It might be easier to do the 'intelligence' before the case structure - i.e. pass your string into 'Match Pattern' to look for the phrase "CurrentMeasurement". If it is present, just pass "CurrentMeasurement" into the case structure.
See the attached.
That help?
Ian
04-15-2011 03:37 PM
If you want to keep this in the case selector, use "CurrentMeasurement..CurrentMeasurement~" as your case. The reason this will work and the "CurrentMeasurement.." you posted in the LabVIEW Minutiae thread doesn't is that "N.." searches for all ASCII characters above N. Lower case ASCII is higher than upper case, which is why "Currenteasurement" and "CurrentMt" trips your case, but not mine. The "~" is the highest value printable ASCII character, which is why it's on the end.
This is not 100% valid, if there is a "~" in the middle of your string it will not catch it. You'll have to determine if that's an issue in your application.
04-15-2011 05:28 PM
@_Ian_ wrote:
As far as I'm aware, the case structure won't do this level of string formatting for you (maybe its something for the idea exchange).
Ian
Do you mean like this one?
04-16-2011 10:20 AM