How to get the extent of field name

sunnyleung

New Member
Hello there,
Please tell me how to get the extent of the progress DB 's field name. here is an example:

abs_mstr
-----------------
abs_doc_data CHAR[5] x(08).


For each _file no-lock where _file-name = "abs_mstr", each _field of _file:
lstchp = lstchp + _field-name + ",".
End.
lstchp = Substring(lstchp,1,LENGTH(lstchp) - 1).

DO WHILE not qh:query-off-end with frame aa:

DO cpt = 1 TO num-entries(lstchp):
fieldname = bh:BUFFER-FIELD(ENTRY(cpt, lstchp)):NAME.
fieldlen=bh:BUFFER-FIELD(ENTRY(cpt, lstchp)):WIDTH-CHARS.
dataType=bh:BUFFER-FIELD(ENTRY(cpt, lstchp)):DATA-TYPE.
fieldformat=bh:BUFFER-FIELD(ENTRY(cpt, lstchp)):FORMAT.
display fieldname dataType fieldlen fieldformat.
down 1.

END.

qh:GET-NEXT().
END.

qh:QUERY-CLOSE().

After running the following program the field-name is only abs_doc_data.

In fact, the field-name should be abs_doc_data[0] ... abs_doc_data[4].

Another question:
If I would like to get the value of field-name of array, How to do ?

Thanks,
Sunny.
 

Casper

ProgressTalk.com Moderator
Staff member
use buffer-field(<fieldname/number>):extent to find out if it is an extent.
if it is no extent then the value = 0.

If you want a value of the extent variable then do something like:
buffer-field(<fieldname/number>):BUFFER-VALUE(<extentnumber>)


Casper
 

DevTeam

Member
Hi,

You can also test the value of _EXTENT (available on _FIELD).

EDIT : I also think that you can find all that you need inside _FIELD (_DATA-TYPE, _FORMAT, _WIDTH, ...)
 

sunnyleung

New Member
Hi,

You can also test the value of _EXTENT (available on _FIELD).

EDIT : I also think that you can find all that you need inside _FIELD (_DATA-TYPE, _FORMAT, _WIDTH, ...)


Please tell how to get the value from _EXTENT(_field-name).
e.g.
For each _file no-lock where _file-name = mytable, each _field of _file:
noArry = 0.
if _EXTENT(_field-name) > 0 then do:
noArry = _EXTENT(_field-name).
end.
END.
 

sunnyleung

New Member
Hi,

You can also test the value of _EXTENT (available on _FIELD).

EDIT : I also think that you can find all that you need inside _FIELD (_DATA-TYPE, _FORMAT, _WIDTH, ...)

Then,
How to get the value from _EXTENT(_field-name) ?
e.g.
For each _file no-lock where _file-name = mytable, each _field of _file:
noArry = 0.
if _EXTENT(_field-name) > 0 then do:
noArry = _EXTENT(_field-name).
end.
END.
 

Casper

ProgressTalk.com Moderator
Staff member
The same as I already told you.
You must make a dynamic query on the table and retrieve the value of the extent filed with:

buffer:buffer-field(<fieldname/number>):BUFFER-VALUE(<extentnumber>)

Casper.
 

DevTeam

Member
then,
how to get the value from _extent(_field-name) ?
E.g.
For each _file no-lock where _file-name = mytable, each _field of _file:
Noarry = 0.
If _extent(_field-name) > 0 then do:
Noarry = _extent(_field-name).
End.
End.
_field._extent ...
 
Top