Using the editcode in a asDisplayString

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
User avatar
Dino
Posts: 477
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Using the editcode in a asDisplayString

Post 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
René Houba
Posts: 220
Joined: Thu Nov 26, 2015 7:03 am

Re: Using the editcode in a asDisplayString

Post by René Houba »

NICE tip Dino, will put this in my Newsletter ;-)

Kind regards,
René
Post Reply