A partner recently asked us how to query for classifications using a path if you
want to use wildcards. Using the built-in ClassificationPath object, one
can very easily load a clasification using its path, but this object does not
support wildcards. An asterisk in a ClassificationPath object is considered as
an actual character.
| C# |
1
2
|
Classification classification = new Classification(app);
classification.Load(new ClassificationPath("/Level 1/Level 1.1/Level 1.1.1"));
|
The alternative is to build a SearchExpression. For
example, to load the following path:
/Level 1/Level 1.*/Level 1.1.1
| C# |
1
2
3
4
5
6
7
|
SearchExpression expression = new SearchExpression(
"Name = 'Level 1.1.1' " +
"Parent[Name = 'Level 1.*' " +
"Parent[Name = 'Level 1' Parent=null]]");
expression.SupportWildcards = true;
Classification classification = new Classification(app);
classification.Load(expression);
|
This way, you can load classifications using wildcards. This obviously can also be used when searching for
records:
| C# |
1
2
3
4
5
6
7
|
SearchExpression expression = new SearchExpression(
"Classification[Name = 'Level 1.1.1' " +
"Parent[Name = 'Level 1.*' " +
"Parent[Name = 'Level 1' Parent=null]]]");
expression.SupportWildcards = true;
RecordCollection records = new RecordCollection(app);
records.Load(expression);
|