Page 1 of 1

Using the editcode in a asDisplayString

Posted: Sat Jul 29, 2023 7:01 am
by Dino
HI,

Just to share this in case you have numbers that you are trying to show in or as part of an string.
Every numeric field in the LANSA repository usually have an edit code.
But if you move that value to a string and want to keep their formatting, you dont need to find what edit code to use again.
Just do something like this:

Code: Select all

#STD_AMNT := 31415.926
#STD_STRNG := #STD_AMNT.AsDisplayString( ("EditCode_" + #STD_AMNT.FieldAttributeAsString( EditCode )) )
that way if the edit code of the field changes, your program still be valid and using the same edit code everywhere...

... you may need to recompile it, but that is easy as going to the xref tab for the field, select the programs there and recompile.

kind regards

Re: Using the editcode in a asDisplayString

Posted: Sun Jul 30, 2023 7:35 pm
by René Houba
NICE tip Dino, will put this in my Newsletter ;-)

Kind regards,
René