I'm searching for code reference or an example on how to:
1. filter on DOM instances
2. Update a DOM instance
Hi Jeroen,
I'm not sure what you already have in place code-wise.
Do you still need to start from scratch?
The below examples assume that you have a lot in place already (eg initiated a DomHelper, have the section definitions and field descriptors, etc.).
If you need more details, please send me a message.
1. There are a couple of ways to filter (or search for) a specific DOM instance.
Either by instance id or by a field value.
var filter = DomInstanceExposers.Id.Equal(instanceId);
var instance = DomHelper.DomInstances.Read(filter).FirstOrDefault();
var filter = DomInstanceExposers.FieldValues.Field(fieldGuid.toString()).Equal(valueToLookFor);
var instances = DomHelper.DomInstances.Read(filter);
var instance = instances.FirstOrDefault();
2. To update a DOM instance, you can first retrieve it using one of the above ways and then update the required fields.
instance.AddOrUpdateFieldValue(sectionDefinition, fieldDescriptor, valueToUpdateTo);
DomHelper.DomInstances.Update(instance);
FYI: The official DOM documentation will be available on docs.dataminer.services in the (very) near future! 🙂
The DOM documentation is now available here: https://docs.dataminer.services/user-guide/Advanced_Modules/DOM/DOM.html
Thanks, it will take some time to try it out.
I’ll be back in the office the 29th 😉