Convert Variant to other data types in C/AL

NoraNora Member Posts: 6
edited 2011-11-11 in NAV Three Tier
Hello!

Does any one know how to convert a Variant into other C/AL data types like integer?

Thanks,
-N

Comments

  • thmartinthmartin Member Posts: 90
    In the case of an integer value the conversion happens implicit by assigning the variant to an integer variable.
    If the value of the variant variable does not match integer you will get a runtime error.


    if VariantVar.ISINTEGER then
    IntVar := VariantVar;
    Thomas Martin
    NAV Developer
  • NoraNora Member Posts: 6
    edited 2011-11-11
    Thanks for the reply Thomas!

    The main issue here is that the IntVar is a DotNet integer. The goal is to assign C/AL datatypes to the corresponding DotNet type. That DotNet integer is Nullable. I thought using the Variant might help. I have attached the error message. Any thoughts?
  • NoraNora Member Posts: 6
    and by the way that DotNet integer is Nullable.
Sign In or Register to comment.