Variant and COPYARRAY

Have anyone seen this error:

You are using an invalid data type for this function.

I’m getting it when I’m using COPYARRAY(Var1,Var2,1)

Both Var1 and Var2 are of the variant type and declared as an array with the length of 3.

hi eric…'m sorry i might be wrong…

TRY CHANGING the datatype to array…

All the best [:)]

sorry when i browsed that was what i got…that the type should be array…but the is no option like array…i dont know why.

I know this one is quite old. But I actually never found the answer. So if anyone has experienced the problem. It worked fine in NAV 5.0, but after upgrading to NAV 2009 (incl. SP1 and R2), then it suddenly doesn’t work.

And to Shona, yes there is no DataType called Array. You can define allmost all datatypes as arrays, by adding a dimension to the properties.


Upgraded from NAV402 to NAV09R2 and the COPARRAY() stopped working at a few places where both arrays are Variant. It works at some other places in the same code where arrays are not variant. Not sure what is causing the issue but the below workaround resolved the issue.


FOR i := 1 TO ARRAYLEN(FromArray) DO
ToArray[i] := FromArray[i];