Using the editcode in a asDisplayString
Posted: Sat Jul 29, 2023 7:01 am
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:
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
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 )) )... 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