Hi Dojo,
I'm trying to create a dom instance through a QAction. I'm getting the following error:
Error creating DomInstance. System.NotSupportedException: This type of ValueWrapper is not supported (ValueWrapper`1)
Which is not very descriptive.
Anyway, I've tried a lot of different things. But I suspect this is due to having a FieldDescriptor of type List<GenericEnum<int>> with multiple options allowed.
private FieldValue HandleFieldDescriptor<T>(FieldDescriptorID fieldDescriptorId, T value, bool wrapAsList = false)
{
// Determine the wrapper type based on the wrapAsList flag
var wrapper = wrapAsList
? (IValueWrapper)new ListValueWrapper<T>(new List<T> { value })
: new ValueWrapper<T>(value);// Return the FieldValue with the appropriate wrapper
return new FieldValue(fieldDescriptorId, wrapper);
}
And I'm using it like this:
var fieldValue = HandleFieldDescriptor(fieldDescriptor.ID, property, isList);
section?.AddOrReplaceFieldValue(fieldValue);
I've also tried to use section?.AddOrUpdateListValue() and section?.AddOrUpdateValue. I keep getting the same.
Any idea how can I troubleshoot this?
Hi Ana, what is the generic type T that is being used for the HandleFieldDescriptor() method? Only the following types are supported: string, double, int, long, DateTime, TimeSpan, bool and Guid.
Looking at the code that you've shared, the type of T is probably 'ValueWrapper<int>' instead of 'int'.
Hi Ana,
If you are using a GenericEnumFielDescriptor of type 'int', make sure that the values you store on the DOM instance are of type 'int'. Here you can find an example: https://docs.dataminer.services/user-guide/Advanced_Modules/DOM/DOM_objects/DOM_FieldDescriptors/DOM_GenericEnumFieldDescriptor.html?q=GenericEnumFieldDescriptor#int-enum-1