semicolon exists in ID

Aug 23, 2013 at 8:51 PM

I know that when specifying multiple properties in a search the semicolon is used as a separator. Is there any way to escape a semicolon that is actually being used as part of the ID. Ideally I'd get the developer to remove the semicolon but in this scenario I might not be able to get them to do that.

I'm sure this was probably discussed before (in fact I remember a thread mentioning something about this), but I was unable to find it so forgive me if this was already answered.

Aug 24, 2013 at 8:48 PM
Hi ddoorn,

Maybe you were thinking of this thread:

In any case, this is currently a limitation in the CUITe framework.

However, support for property values with a semicolon can be added if/when needed.

If you'd like to use a different character to separate multiple search properties, the code can be updated to make this configurable using an application configuration setting value for example as well as dynamically.

If you'd like to try and update the source code accordingly, I can help you to get its functionality built-in to CUITe.

Thank you.
Aug 26, 2013 at 1:13 PM

Is there a way to modify it for the one scenario I've encountered? I'd rather not change the separator throughout all of my code.

Aug 27, 2013 at 1:58 AM
I think I found a solution. I did a little research online and found a regex expression that allows you to use \ as a way to escape a character if you don't want it to split by that semicolon. Disclaimer: I'm not familiar with Regex - so I did test this against my own project and it worked successfully but I can't guarantee anything (so if you like it, feel free to submit it).

In the CUITe_ControlBase.cs I modified this line to split it. I'm not sure what the performance impact would be for this kind of change, but I double there are many examples with many properties so I doubt the impact is that large.
// Split on groups of key/value pairs
            string[] saKeyValuePairs = Regex.Split(searchProperties, @"(?<!(?<!\\)*\\)\;"); //searchProperties.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
After the key/value pairs are split I make sure to replace the escaped semicolon such that the matching will work as expected (I verified it won't match if you don't do this).
// Add the search property, value and type
                this.SearchProperties.Add(foundField.GetValue(null).ToString(), saKeyVal[1].Replace(@"\;", ";"), compareOperator);