I am implementing a webservice. I created the reference without problems.
In the script I run into the problem I have to pas a value to a function
void measurement.set_length(Nullable`1 type)
How can i pass a value to this Nullable`1 type?
In the generated source file I can see it is declared as a System.Nullable<decimal>
I tried :
But the `sign is not allowed in scripts
This gives a strange Table is out of range error..
X++ doesn't support generics, so it's always a bit tricky to work with generic types in AX. Another problem may be that Nullable<T> is a structure, not a class.
I would try something like this:
System.Type nullableType = System.Type::GetType('System.Nullable`1[System.Decimal]');
System.Object decimalValue = System.Convert::ToDecimal(123);
System.Object paramValues = new System.Object();
nullableValue = System.Activator::CreateInstance(nullableType, paramValues);
Martin "Goshoom" Dráb | Freelancer | Goshoom.NET Dev Blog
Thanks for your replay.....
but is does not solve the compile-time error.
nullableValue is of type CLRObject and I can't pass it to the function.
But the hint to use System.Type::GetType('System.Nullable`1[System.Decimal]'); might be usefull. :-)
It works in AX2012, but apparently not in AX2009. Sorry.
You can't use generic types in variable declaration in X++, so you'll have to change the service to accept non-generic parameters or to create a proxy client in .NET if you can't (or don't want) to change the service.