cnsGetIdSet()

Returns the names of data points linked to the matching nodes.

Synopsis

bool cnsGetIdSet(string pattern, [string view, ], int whichNames, int langIdx, int type, dyn_string &dps);

Parameters

Parameter Description
pattern

This pattern is checked against the ID path or display name path.

As of version 3.20, there is a new default behavior.

The wildcards *, ** and ? can be used depending on the config entry cnsUseDoubleAsterisk in the [general] section.

The config entry is set to 1 by default, which means that:

  • One asterisk * returns one level.
  • Two asterisks ** return all levels.
  • The question sign ? returns one character.

You can also activate the old behavior by setting the config entry to 0. This means that 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 the search pattern is matched with the ID path, display name path or both. Moreover it defines whether case sensitivity shall be enabled. The following predefined constants can be used:

  • CNS_SEARCH_NAME - match with ID path
  • CNS_SEARCH_DISPLAY_NAME - match with name path
  • CNS_SEARCH_ALL_NAMES - match with both paths
  • CNS_SEARCH_CASE_INSENSITIVE - match case insensitive

The constans can be combined by using the pipe |.

langIdx

Defines which language of the display name path shall be checked.

  • CNS_SEARCH_ALL_LANGUAGES - match all languages

This parameter is ignored if neither CNS_SEARCH_DISPLAY_NAME nor CNS_SEARCH_ALL_NAMES is defined for the whichNames parameter.

type

Restricts the result to the given CNSDataIdentifierType.

  • CNS_SEARCH_ALL_TYPES - return nodes with all types
  • custom types - return only nodes with this type
dps Receives the names of data points linked to matching nodes. The result is a set, therefore each unique data point is only contained once.

Return value

Returns TRUE if successful or FALSE in case of an error.

Errors

-

Description

This function searches for nodes by matching their path with a wildcard pattern. It returns the names of the data points linked to the matching nodes.

Anmerkung:

The following characters are not allowed for separators: '(single quotation mark),"(quotation marks),*(asterisk),?(question mark).

Moreover, numbers and letters which are already used in the view or node name must not be used.

Returns the data points for the Node2.

#uses "CtrlCNS"

main()
{
  dyn_string dps;
  bool i;

  i = cnsGetIdSet("*Node2*","System1.View1:", CNS_SEARCH_ALL_NAMES, CNS_SEARCH_ALL_LANGUAGES, CNS_SEARCH_ALL_TYPES, dps);
  DebugN(i, dps);
}

Availability

UI, CTRL