Consultor Eletrônico



Kbase P144427: 4GL/ABL: Why does the DISPLAY statement not use the format expression parameter of the ADD-NEW-FIELD
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   4/13/2009
Status: Unverified

GOAL:

4GL/ABL: Why does the DISPLAY statement not use the format expression parameter of the ADD-NEW-FIELD() method?

GOAL:

Why does the DISPLAY statement outputs the Buffer-field object handle's STRING-VALUE using the "X(8)" FORMAT when the format expression parameter of the ADD-NEW-FIELD() method is greater than 8?

GOAL:

Should I use the Buffer-field object handle's STRING-VALUE or its BUFFER-VALUE to display its value using the DISPLAY, PUT CONTROL or PUT UNFORMATTED statements?

GOAL:

How to make the DISPLAY statement respect the format expression parameter of the ADD-NEW-FIELD() method?

FACT(s) (Environment):

All Supported Operating Systems
Progress 9.x
OpenEdge 10.x

FIX:

The DISPLAY statement can not not use the format expression parameter of the ADD-NEW-FIELD() method because the DISPLAY statement is formatted at compile time which is before the ADD-NEW-FIELD() has been executed.
The DISPLAY statement takes any Buffer-field object handle's STRING-VALUE or BUFFER-VALUE as a runtime expression and allocates 8 spaces for it. This explains why a DISPLAY statement, that is not qualified with the FORMAT phrase, outputs the Buffer-field object handle's STRING-VALUE or BUFFER-VALUE using the CHARACTER default "X(8)" FORMAT of CHARACTER fields and variables. For example each of the following two statements would output the dynamic Buffer-field object handle's value using the "X(8)" format:
DISPLAY hFieldBuffer:STRING-VALUE.
DISPLAY hFieldBuffer:BUFFER-VALUE .
To display a dynamic Buffer-field object handle's value using the DISPLAY statement in the format expression parameter passed to the ADD-NEW-FIELD() method, display the Buffer-field object handle's STRING-VALUE attribute with the FORMAT phrase of the DISPLAY Statement making sure . For example:
DISPLAY hFieldBuffer:STRING-VALUE FORMAT "X(40)".
Also, to display a dynamic Buffer-field object handle's value using a PUT CONTROL or a PUT UNFORMATTED statement in the format expression parameter passed to the ADD-NEW-FIELD() method, use the Buffer-field object handle's STRING-VALUE attribute and not its BUFFER-VALUE attribute because using the Buffer-field object handle's BUFFER-VALUE attribute outputs the whole string in total disregard to the format expression parameter of the ADD-NEW-FIELD() method.