dpNames()

Returns all the data point names or data point element names that match a pattern. The data point structures are written to the array in alphabetical order.

Synopsis

dyn_string dpNames([string dpPattern[,string dpType][. bool ignoreCase = false]]);

Parameter

Parameter Meaning
dpPattern Pattern
dpType

Data point type

Allows to restrict the returned data points to a specific data point type. When using the parameter only data points that are matching the pattern and the selected data point type will be returned.

ignoreCase Defines if the search should ignore the casing of the search pattern (=true) or not (=false, default)

Note that the function returns the names of data point types per system!

Return Value

List with data points or data point elements.

Errors

Errors can be retrieved with getLastError() . If there are missing arguments or if the data point does not exist. If "0" is specified as the type.

Description

The function dpNames() returns all the data point names or data point element names that match the pattern dpPattern. The option dpType also filters by a data point type. If no dpPattern is specified, all the data point names are returned. Wildcards may also be used to filter data point names. In this way dpNames("*") only refers to the top level (root elements) of a data point structure and returns all the data point names. It is therefore equivalent to dpNames().

If a data point is returned with a structure, the structure must be described. Only data points that have the same number of levels as specified are found. Levels are separated by a period. dpNames(**) is equivalent to dpNames(*.*). Furthermore:

  • ":*" returns all configs, ":config.*" returns all details, ":config.detail.*" returns all attributes

  • "dp.el:*" returns only the configs according to the DPE. , for example, no _original for a node.

dpNames allows also to query data points from a different system

Note that the config entry maxDpNamesCount = xxx can be used to restrict the amount of the queried data points. If you specify the entry in the config file and call the dpNames() function so that the return value of the function is bigger than the amount allowed via the config entry an error message is shown.

Example: The DPT of the data point engine

A dpNames (*.*.*) finds an engine because there are occurrences of the engine with 3 levels.

engine.setpoint.engineSpeed

A dpNames (*.*) finds an engine because there are occurrences of the engine with 2 levels.

engine.setpoint and engine.currentValue

Standard pattern matching applies within a level, for example, dpNames ("*DP*") finds the data points Example DP_Arg2, ExampleDP_DDE, _DP etc.

Querying with wildcards is not possible for dpType!

Example

Assignment of all data point elements of the data point Valve17, including Valve17.opening, to the variable names.

main()
{
  dyn_string names;
  names = dpNames("Valve17.*");
}

Example

Example of wildcards in lists of options

main()
{
  string s;
  DebugN(dpNames(s = "{*.Ala.*,*.Ala*}"), s);
  DebugN(dpNames(s = "*{.Ala.,.Ala}*"), s);
  DebugN(dpNames(s = "*.A{la.,la}*"), s);
  DebugN(dpNames(s = "*.Al{a.,a}*"), s);
  DebugN(dpNames(s = "*.Ala{.,}*"), s);
  DebugN(dpNames(s = "*.Ala{.}*"), s);
  DebugN(dpNames(s = "*.Ala.*"), s);
  DebugN(dpNames(s = "*.Ala*"), s);
}

Example

Query of the data points with additional system name. Saves the names of all data point elements of the datapoint Valve17 from System2 into the variable names.

main()
{
  dyn_string names;
  name = dpNames("System2:Valve17.*");
}

Assignment

Data point function, waiting Control function

Availability

CTRL