dynDynTurn()

The function dynDynTurn turns rows of a dyn_dyn_type variable into columns and visa versa.

Synopsis

int dynDynTurn(dyn_dyn_type &dynvar).

Parameter

Parameter Description
dynvar Variable holding data point values. This variable results from a data point query. See example further below.

Return Value

The function returns -1 in case of errors and otherwise the number of changed rows or columns.

Errors

Missing or wrong arguments.

Description

The function dynDynTurn turns rows of a dyn_dyn_type variable into columns and visa versa.

The function is useful for turning the rows of a dyn_dyn_type variable into columns. The dyn_dyn_type variable results from a data point query. The function is useful when filling DP query data into a table shape using updateLines or appendLines.

Example

The example retrieves the values of data points of Name ExampleDP_Arg* whose type is ExampleDP_Float, (Note that the code row for the query is on one row and not separated on two rows in your code) adds the values to a table. Before the values will be added to a table, the query header will be removed and the rows will be set to columns and vice versa using the function dynDynTurn.

main()
{
  dyn_dyn_anytype tab;
  int z;
  dpQuery("SELECT '_original.._value' FROM 'ExampleDP_Arg*'
  WHERE
  _DPT=\"ExampleDP_Float\" ", tab);
  //_DTP returns the type of a data point
  DebugN("Query executed:", tab);
  dynRemove(tab, 1); //remove query header
  dynDynTurn(tab); // rows are set to columns and vice versa
  DebugN("dynDynTurn executed:");
  setValue("ValueTable","updateLines", 1, "dpe", tab[1], "value",
  tab[2]);
  /* Values are added to a table called ValueTable in the columns
  "dpe" and 
  "value" */
}

Assignment

Dynamic arrays

Availability

CTRL