cnsGetNodesByName()
Looks for ID paths of nodes that match the given criteria.
Synopsis
bool cnsGetNodesByName(string pattern, [string view,] int whichNames, int
langIdx, int type, dyn_string &cnsPaths);
Parameters
Parameter | Description |
---|---|
pattern |
This pattern is checked against the ID path or display name path. The wildcards * and ? can be used. One asterisk * returns all levels. The question sign ? returns one character. |
view | Restricts the search to the given view |
whichNames |
Defines whether to look for ID path, display name path or both. Furthermore, it is possible to define if case-sensitivity is enabled or not. Therefore, the following constants are available:
These constants can be combined by using the pipe |. |
langIdx |
Defines in which language the name paths shall be matched.
This parameter is ignored if whichNames is not defined as CNS_SEARCH_ALL_NAMES or CNS_SEARCH_DISPLAY_NAMES |
type |
Limits the result to a matching CNSDataIdentifierType. The following constants are available:
|
cnsPaths | Receives the ID paths of the nodes which match the criteria. |
Return value
Returns TRUE if successful or FALSE in case of an error.
Errors
-
Description
This function returns ID paths of nodes that match the given criteria.
This function returns ID paths of nodes that match the given search criteria ( "Node1" under View1, all languages are searched and the function searches for the structure type). Note that you have to specify a leading * for the search pattern in order to receive a result.
main()
{
dyn_string dps;
cnsGetNodesByName("*Node1", "System1.View1:", CNS_SEARCH_ALL_NAMES, CNS_SEARCH_ALL_LANGUAGES,CNS_DATATYPE_EMPTY, dps);
DebugN(dps);
}
Returns all data point paths that match the search pattern (the path contains an 'o' and the search is case insensitive).
main()
{
dyn_string nodes;
cnsGetNodesByName("*o*", CNS_SEARCH_NAME | CNS_SEARCH_CASE_INSENSITIVE, CNS_SEARCH_ALL_LANGUAGES, CNS_DATATYPE_DATAPOINT, nodes);
DebugN("Paths:", nodes);
}
Availability
UI, CTRL