Hello all,
Is there any way to update the value of a View property from an automation script? Method "SetPropertyValue" exists but it can be only used for Elements or Services. Thanks
Hi Pilar,
You should be able to use the Class Library to achieve this
See the snippet below
IDms dms = engine.GetDms();
var myView = dms.GetView("MyViewName");
if (myView.Properties.FirstOrDefault(v => v.Definition.Name == "MyViewProperty") is IWritableProperty myViewProperty)
{
myViewProperty.Value = "MyNewValue";
myView.Update();
}
For this, you will need to add the Class Library NuGet to your solution (see Skyline.DataMiner.Core.DataMinerSystem.Automation)
Hi Pilar,
I believe the answer to this question should help you forward.
To add a note based on the answer from @Ive, my answer does have the “limitation” of only being able to update a single view at a time.
You can do multiple properties on the same view and only call the myView.Update() at the end but for multiple views you either need to loop over the views and do 1-by-1 or go with the answer mentioned by @Ive