Wednesday, 19 March 2025
Container element\values which has leading zeros are getting trimmed? Solution: Use ContainerClass
A container is a data type that can hold a collection of elements of different types. Containers store various data types such as integers, strings, and real numbers. They are particularly useful for passing multiple values between methods or objects or storing heterogeneous data.
While accessing container values from forms,  values with leading zeros are being trimmed in some cases.
For example: [0050, 0060, 0070]. While accessing this container from form args\object , [50, 60, 70] is returned.
To resolve thsi issue we can use ContainerClass concept in D365 as below.
Declare containerClass in calledForm init().
ContainerClass containerClass = element.args().parmObject() as ContainerClass;
Container      parmCon        = containerClass.value();
Str            value1         = conpeek(parmCon, 1); 
Str            value2         = conpeek(parmCon, 2);
Str            value3         = conpeek(parmCon, 3); 
Output :
value1 = 0050
value2 = 0060
value3 = 0070
Subscribe to:
Comments (Atom)