AL icon indicating copy to clipboard operation
AL copied to clipboard

Dictionary and Variant

Open Walwode opened this issue 9 years ago • 3 comments

Hi,

I do have a "Variable Register" that is a Dictionary containing different values.

var
    VariableRegister : Dictionary of [Text, Text];

is possible. I need to add Date, DateTime, Integer, ... etc values, therefore i'm in need to use variant

var
    VariableRegister : Dictionary of [Text, Variant];

which is not possible. I want to avoid creating a Dictionary for every field type (Date, DateTime, Integer, Decimal, Text, GUID, ...)

(In C/SIDE i used a DotNet Dictionary and added the Variant values)

Walwode avatar Nov 10 '17 15:11 Walwode

We currently have a limitation on the times that can be used in Dictionary - same limitation as for what types can be returned from a method.

This is rooted in the runtime and we would like to remove it in the future. It is related to the lifetime of nav-objects and requires some rework in the runtime.

esbenk avatar Nov 11 '17 09:11 esbenk

Thank you for you answer, esbenk. So for now i have to create a dictionary for all field types? :( Alternatively i can use a XML converted string and store additionally the pre-conversion-type. But that makes it all much more complicated and performance consuming. Also, i think this won't work well for streams (necessary to convert base64) of BLOB or Media/Set fields.

Walwode avatar Nov 14 '17 09:11 Walwode

Unfortunately yes. We would like to change the platform to support this in the future and at the same time allow more return types from methods.

esbenk avatar Nov 14 '17 09:11 esbenk