Kbase P128794: How to specify DECIMALS in a field in a dynamic temp-table
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  2/7/2008 |
|
Status: Unverified
GOAL:
How to specify DECIMALS in a field in a dynamic temp-table
FACT(s) (Environment):
All Supported Operating Systems
Progress/OpenEdge Versions
FIX:
The ABL currently provides no way to directly set the DECIMALS attribute on a decimal field in a dynamic temp-table. To accomplish this you must either define a static temp-table and use CREATE-LIKE or define a dummy temp-table with sample decimal field definitions that can be used in conjunction with the ADD-LIKE-FIELD method.
e.g.
DEFINE TEMP-TABLE tt
FIELD tdeDecs0 AS DECIMAL DECIMALS 0
FIELD tdeDecs1 AS DECIMAL DECIMALS 1
FIELD tdeDecs2 AS DECIMAL DECIMALS 2
FIELD tdeDecs3 AS DECIMAL DECIMALS 3
FIELD tdeDecs4 AS DECIMAL DECIMALS 4
FIELD tdeDecs5 AS DECIMAL DECIMALS 5
FIELD tdeDecs6 AS DECIMAL DECIMALS 6
FIELD tdeDecs7 AS DECIMAL DECIMALS 7
FIELD tdeDecs8 AS DECIMAL DECIMALS 8
FIELD tdeDecs9 AS DECIMAL DECIMALS 9.
DEFINE VARIABLE hTT AS HANDLE NO-UNDO.
DEFINE VARIABLE hField AS HANDLE NO-UNDO.
CREATE TEMP-TABLE hTT.
hTT:ADD-NEW-FIELD("mykeyField","INTEGER").
hField = BUFFER tt:BUFFER-FIELD("tdeDecs3").
ASSIGN hField:LABEL = "Blah"
hField:FORMAT = "->>>,>>>,>>>.999". /* Modify attributes of static tt field to match usage */
hTT:ADD-LIKE-FIELD("myThreeDecimalsField","tt.tdeDecs3").
hTT:TEMP-TABLE-PREPARE("tt2").
hField = hTT:DEFAULT-BUFFER-HANDLE:BUFFER-FIELD('myThreeDecimalsField').
MESSAGE hField:DECIMALS SKIP
hField:FORMAT SKIP
hField:LABEL
VIEW-AS ALERT-BOX INFO BUTTONS OK.