Tairec

tairec returns the size of a record (line) in an opened table. It is an integer variable present in the [G:abv] class associated with a table opened with the abv abbreviation.

Syntax

[G:ABV]tairec

Example

# Returns the properties of a table defined by TABLENAME parameter in a JSON feedSubprog TABLE_DESCRIPTION(TABLENAME,RESULT)Variable Clbfile RESULT()Value Char TABLENAME()If clalev([XXX]) : LogicClose File [XXX] : Endif : Local File =TABLENAME [XXX]RESULT="{"Append RESULT,' "table" : "' + TABLENAME + '",'Append RESULT,' "columns_number" : ' + num$([G:XXX]nbzon) + ','# List of column (we skip I=0)Append RESULT,' "columns" : ['For I=1 To [G:XXX]nbzon-1Append RESULT,string$(I>1,",") + '"' + [G:XXX]adxfname(I) + '"'Next IAppend RESULT,' ],'Append RESULT,' "index_number" : ' + num$([G:XXX]nbind) + ','# List of indexesAppend RESULT,' "indexes" : ['For I=1 To [G:XXX]nbindAppend RESULT, string$(I>1,",")+ '{'Append RESULT, '"name":"' + [G:XXX]keyname(I-1) + '",'Append RESULT, '"length":' + num$([G:XXX]keylen(I-1)) + ','Append RESULT, '"duplicated":' + string$([G:XXX]keyuniq(I-1)=1,"true") + string$([G:XXX]keyuniq(I-1)=0,"false")Append RESULT, '}'Next IAppend RESULT,'],'Append RESULT,'"record_length":'+num$([G:XXX]tairec)Append RESULT,'}'End
On the table "ACCESS", the result (normalized) of the JSON generated by this script is the following:
{"table": "ACCES","columns_number": 12,"columns": [ "CODACC", "USR", "CONSUL", "EXEC", "MODIF", "PRFCOD", "CREUSR", "UPDUSR", "CREDATTIM", "UPDDATTIM", "AUUID" ],"index_number": 2,"indexes": [{ "name": "CODACC", "length": 40, "duplicated": false },{ "name": "PRFCOD", "length": 50, "duplicated": true }],"record_length": 109}

See also

nbzon, nbind, adxfname, keyname, keylen, keyuniq.