Kbase P73795: How to retrieve the data length of a field in the Data Dicti
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  3/25/2004 |
|
Status: Unverified
GOAL:
How to retrieve the data length of a field in the Data Dictionary
FIX:
As an example on how to retrieve the length of the Data Dictionary I can provide you the following code:
FOR EACH _File:
FOR EACH _Field OF _file:
DISPLAY _Field._Field-NAME
_Field._Data-type
_Field._Format
_Field._Decimals
WITH FRAME a 1 COLUMN.
END.
END.
To retrieve a field length.
FOR EACH customer:
DISPLAY string(NAME) LENGTH(STRING(NAME)).
END.
Base on that information from the MetaSchema you can try to compare the String length of the data Field you have in way to check the format or the length.
Remember that the Format of the Data Dictionary is just a display format.
This means that if the field is for example Char "X(20)" and your data is length 25 it will be stored inside the DB without problem, the only thing is that at display the field will be truncated.
However is a Display format is lower than the field length you can override the Display format at runtime using the FORMAT option within the display.
As for example:
Data dictionary MyField format is "X(20)".
DISPLAY MyTable.MyField FORMAT "X(50)" will display the field with format "X(50)".