Hello,
We pretend to create a script to update all the resources (destination and source) of a matrix to avoid any mismatching mnemonic.
As you guys can see on the screenshot attached, to create a resource of a matrix, on the Device tab, we link the matrix on the element field and the output/input on the instance parameter;
To make it more “friendly” to the costumer, on the General tab, we gave a label (name) which matches with the physical matrix mnemonical.
After some tests, we noted that there was some outputs with a different label if compered with the physical matrix due a change made by the costumer; Our point is: Is it possible to create a script which will read all the inputs or outputs of a matrix and them update the resource name according to it?
Regards,
Yohan
Hi Yohan,
Yes you can, below you can find an example of some code to do it, you will need to complete with the logic to get the correct resources and the correct names.
var resourceManager = new ResourceManagerHelper(engine.SendSLNetSingleResponseMessage);
// Adapt the filter according to your needs
var filter = FunctionResourceExposers.MainDVEElementID.Equal(mainElementId);
var resources = resourceManager.GetResources(filter);
foreach (var resource in resources)
{
// Some logic to generate the new name
resource.Name = newName;
}
resourceManager.AddOrUpdateResources(resources);