GET & SET
GET & SET
(OP)
When I do a verification of the existence of a value and then modified, do this:
TABLE:COD=X
GET(TABLE,TABLE:KEY)
IF ERRORCODE()
..
END
TABLE:COD=X
SET(TABLE:KEY,TABLE:KEY)
NEXT(TABLE)
TABLE:NOM='XXXX'
ACCESS:TABLE.UPDATE()
because I'cant GET to modify the data, but yes with the SET. At the same time, if I use the SET / NEXT then I can not corroborate the FIELD = VAR because always return yes!.
There is a more flexible working? Thanks.
TABLE:COD=X
GET(TABLE,TABLE:KEY)
IF ERRORCODE()
..
END
TABLE:COD=X
SET(TABLE:KEY,TABLE:KEY)
NEXT(TABLE)
TABLE:NOM='XXXX'
ACCESS:TABLE.UPDATE()
because I'cant GET to modify the data, but yes with the SET. At the same time, if I use the SET / NEXT then I can not corroborate the FIELD = VAR because always return yes!.
There is a more flexible working? Thanks.
RE: GET & SET
1. You need to use a CLEAR(TABLE:RECORD) before a GET or SET to make sure that the record buffer is empty.
2. GET() will work ONLY is the Key is UNIQUE.
3. When you use SET(), you should ALWAYS check if the record key is the one you want before you update it i.e.
CODE
SET(TABLE:KEY,TABLE:KEY)
NEXT(TABLE)
IF NOT ERRORCODE() AND TABLE:COD = X
TABLE:NOM='XXXX'
ACCESS:TABLE.UPDATE()
END
Regards
RE: GET & SET