Porovnávané verzie

Kľúč

  • Tento riadok sa pridal
  • Riadok je odstránený.
  • Formátovanie sa zmenilo.

COPYSTRUCT action


Function
The action copies the specified row/rows of the structured local variable to other local structured variable (i.e. local variable of Record type).
Declaration


Blok kódu
languageesl
themeConfluence
 COPYSTRUCT _dstStruct, _fromRow, _firstRowToCopy[, _lastRowToCopy]
 
or
 


Blok kódu
languageesl
themeConfluence
 COPYSTRUCT _dstStruct, _fromRow, _srcStruct
Parameters


_dstStructin/outIdentifier of local variable of Record type - destination structure.
_fromRow>inIdentifier of Int type - first row in destination structure (_dstStruct). Specified row, rows or whole structure will be copied (inserted) to destination structure from it (including).
_firstRowToCopyinIdentifier of a row of source local variable - first row to be copied.
_lastRowToCopyinOptional parameter - identifier of a row of source local variable - last row to be copied.

Note: If the parameter is not specified, the action will copy just the row specified by the parameter _firstRowToCopy.
Description
The action copies:
  • one row - only the parameter _firstRowToCopy is specified (the parameter _lastRowToCopy is NOT)
  • rows - both the parameters _firstRowToCopy and _lastRowToCopy are defined
  • whole structure - 2nd declaration (the parameter _srcStruct)
The row, rows or entire structure to be copied and inserted into the local variable specified by the parameter _dstStruct on the position given by the parameter _fromRow and below.
If the size of destination structure _dstStruct is not sufficient, the action will generate the error _ERR_RANGE_ERROR.

The local variables _dstStruct, _firstRowToCopy and _srcStruct must be the same type (they must have the same structure definition).

If the parameter _lastRowToCopy is specified, the action copies the rows between the parameters _firstRowToCopy and _lastRowToCopy including. In this case both the parameters must represent a row of the same structure.
Example


Blok kódu
languageesl
themeRDark
 RECORD (SD.ArchData) _src
 RECORD (SD.ArchData) _dst
 INT _idx
 
 BEGIN
 ; fill source variable with values from 1 to 10
 REDIM _src[10]
 _idx := 1
 
 DO_LOOP
 EXIT_LOOP _idx > _src\DIM
 _src[_idx]^value := _idx
 _idx := _idx + 1
 END_LOOP
 
 ; set the size of destination variable
 REDIM _dst[11]
 
 
 ; copy one row from structure _src to 4th row of structure _dst
 ; _dst[4] <-- _src[5]
 
 COPYSTRUCT _dst, 4, _src[5]
 
 
 ; copy two rows from structure _src to structure _dst (from 3rd row down)
 ; _dst[3] <-- _src[5]
 ; _dst[4] <-- _src[6]
 
 COPYSTRUCT _dst, 3, _src[5], _src[6]
 
 
 ; copy all rows from structure _src to structure _dst (from 2nd row below)
 ; _dst[2] <-- _src[1]
 ; _dst[3] <-- _src[2]
 ; _dst[4] <-- _src[3]
 ; ...
 
 COPYSTRUCT _dst, 2, _src
 
 END 

Info
titleRelated pages:

Script actions