Tips and Techniques: Copy Numeric Data to Character and Keep the Leading Zeros
** This thread discusses the article: Tips and Techniques: Copy Numeric Data to Character and Keep the Leading Zeros **
padshore wrote: > I have been using this built in function, with X to create a > character field, and retain the leading zeroes. I now have a problem, > in the sense that the field contains a negative number. Is there an > easy(!) way to convert this number, with leading zeroes, with > trailing/leading minus. Using %editc with an X gives me the following > result for 00000029-, the result is 0000002R I belive what would traditionally be done would be to have a seperate field that is loaded with the minus sign conditioned upon the original fields value. If nOrigFld < 0 cSign = '-' Else cSign = ' ' EndIf Then either prepend or append cSign to your character field. Bill
Unconfigured Ad Widget
Collapse
Announcement
Collapse
No announcement yet.
Tips and Techniques: Copy Numeric Data to Character and Keep the Leading Zeros
Collapse
X
-
Guest replied
-
Tips and Techniques: Copy Numeric Data to Character and Keep the Leading Zeros
** This thread discusses the article: Tips and Techniques: Copy Numeric Data to Character and Keep the Leading Zeros **
I have been using this built in function, with X to create a character field, and retain the leading zeroes. I now have a problem, in the sense that the field contains a negative number. Is there an easy(!) way to convert this number, with leading zeroes, with trailing/leading minus. Using %editc with an X gives me the following result for 00000029-, the result is 0000002R Thanks in advance Alan
Leave a comment:
-
Guest repliedTips and Techniques: Copy Numeric Data to Character and Keep the Leading Zeros
** This thread discusses the article: Tips and Techniques: Copy Numeric Data to Character and Keep the Leading Zeros **
Just like any problem there can be many solutions. Here is what I have been doing. D SaveNote S 12S 0 Inz D WkNoteA S 12 Inz EvalR WkNoteA = '000000000000' + %Char(%Int(SaveNote)); Note that EvalR must be used.
Leave a comment:
-
Tips and Techniques: Copy Numeric Data to Character and Keep the Leading Zeros
** This thread discusses the article: Tips and Techniques: Copy Numeric Data to Character and Keep the Leading Zeros **
** This thread discusses the Content article: Tips and Techniques: Copy Numeric Data to Character and Keep the Leading Zeros **
0Tags: None
Leave a comment: