dynContains()

Returns the index of the first occurrence of y in the dynamic field x

Synopsis

int dynContains(<dyn_type> x, <type> y);

Parameters

Parameter Meaning
x field to be examined
y value to be searched

Return Value

If x not contains y 0, in the event of an error -1.

Errors

A message is issued in the event of missing or incorrect arguments.

Description

Returns the index of the first occurrence of y in the dynamic field x. The data types of y and x have to be in accordance. For example y may not be a dynamic field!

If you look for the content of an atime variable in a dynamic field (dyn_atime), only time and count of the atime variable will be checked against the entries in the field. The DpIdentifier will not be checked. This results in the following behavior:

dyn_atime 2 items

1: 2013.05.28 17:48:37.671 (0 ) System1:Test1.:_alert_hdl (Type: 84 Sys: 1 Dp: 429 El: 4 : _alert_hdl..0)

2: 2013.05.28 17:33:35.137 (0 ) System1:Test1.:_alert_hdl (Type: 84 Sys: 1 Dp: 429 El: 5 : _alert_hdl..0)

You look for:

2013.05.28 17:33:35.137 (0 ) System1:Test23.:_alert_hdl (Type: 84 Sys: 1 Dp: 429 El: 6 : _alert_hdl..0)

dynContains returns the index 2, even though this element is not existing in the dynamic field and the correct return value must be 0.

Example

main()
{
  dyn_int d;
  d=makeDynInt(60,30,80);
  DebugN(dynContains(d,30)); // returns 2
}

Assignment

Dynamic fields

Availability

CTRL