INT _cntHandle INT _key INT _idx INT _nr TEXT _valueStr BOOL _bFound RECORD NOALIAS (SD.Data) _rec RECORD NOALIAS (SD.Data) _rec2 BEGIN REDIM _rec[10] ; creating a container CNT_CREATE _cntHandle CNT_DEBUG _cntHandle, "CNT1" ; filling the container _key := 1 _idx := 1 DO_LOOP ; if _key is an even number, then inserts a text, otherwise a structured variable row IF %Mod(_key, 2) = 0 THEN _valueStr := %IToStr(_key) CNT_INSERT _cntHandle, _key, _valueStr ELSE CNT_INSERT _cntHandle, _key, _rec[_idx] _idx := _idx + 1 EXIT_LOOP _idx > _rec\DIM ENDIF _key := _key + 1 END_LOOP ; reading value from the container CNT_FIND _cntHandle, 5, _rec[2], _bFound IF _bFound THEN ; there must be the value ENDIF ; REDIM _rec2[5] CNT_FIND _cntHandle, 5, _rec[2], _bFound IF _bFound THEN ; there must be the value ENDIF ; ; going over all values of the container CNT_GETNR _cntHandle, _nr CNT_CNVTOARRAY _cntHandle ; FOR _idx=1 TO _nr DO_LOOP ; what value type is in the container? IF %Mod (_idx, 2) = 0 THEN CNT_GETITEM _cntHandle, _idx, _valueStr ELSE CNT_GETITEM _cntHandle, _idx, _rec2[3] ENDIF END_LOOP ; CNT_DEBUG _cntHandle ; destroying the container CNT_DESTROY _cntHandle END
Related pages:
0 komentárov