Consultor Eletrônico



Kbase P148988: 4GL/ABL: How is the length of a frame column label determined for fields and variables?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   7/8/2009
Status: Unverified

GOAL:

4GL/ABL: How is the length of a frame column label determined for fields and variables?

GOAL:

Why is the column width of each of my array elements is 11 and not 10 as I expect?

GOAL:

Why, in the following code, is the label length of the t-dummy2[1] element is 11 and not 10?
def var t-dummy as char extent 3 format "x(10)" no-undo .
def var t-dummy2 as char extent 3 format "x(10)" no-undo .
FORM
t-dummy2
with stream-io width 176 down no-box frame f-summary-salesrep.
FORM
t-dummy
with stream-io width 176 down no-box frame f-detail.
MESSAGE
"The default length of t-dummy label:~t" LENGTH (t-dummy[1]:LABEL) "~n"
"The default length of t-dummy2 label:~t" LENGTH (t-dummy2[1]:LABEL)
VIEW-AS ALERT-BOX INFO BUTTONS OK.

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x
OpenEdge Category: Language (4GL/ABL)

FIX:

The label length of the t-dummy2[1] element is 11 because the LABEL attribute was not used in either the variable definition or the FORM definition. The documentation on the FORMAT phrase says that for a field, Progress will use the LABEL string specified ( in the FORM or FRAME definition) if available. If a LABEL string is not specified for the field in the FORM or FRAME definition, then Progress will use the LABEL string specified in the Data Dictionary for that field if available. Finally, if a LABEL string is not specified for the field in the Data Dictionary, Progress will use the field name as the LABEL.
Similar logic is used to determine the LABEL for a variable. If a LABEL string specified in the variable, FORM or FRAME definition, then that will be used, else, if the variable is defined LIKE some database field, then the label will be inherited from that field if available, else the variable name will be used as the default LABEL.
In the above code, the field LABEL string is not defined in either the variable definition or the FRAME definition, therefore, Progress uses the name as the default LABEL. The number of characters in the name t-dummy2[1] is 11. And that is why LENGTH (t-dummy2[1]:LABEL) returns 11.
Notice that since the number of characters in the name t-dummy[1] is 10. And that is why LENGTH (t-dummy[1]:LABEL) returns 10.