Hello ,
I have been trying to use the SetParamerter method in the script class to trigger a specific component of an element that has been found by the correlation rule filters.My full automation script is fully functioning but breaks in the SetParameter line ( used print statement and exceptions for checking).I believe I am having issues with the parameters used inside the () of the method.
I have tried out both SetParameter and SetParameterByPrimaryKey , using the parameterId,primaryKey,object value and IDx (depending on the method).
From my understanding of the primary key , it is unique for each component in an element ,so usually it should be hardcoded with exact value/string. But using my script , I wanted to dynamically initialize the parameter or put a part of the full string which will help to identify the exact position of the cell in the components list of the element. Could anyone please guide through where I am going wrong.
The error message:
An error occurred while setting the parameter: Set Parameter ('_117620_1711':10140/) Failed: 0x80004005 (Script 'Failure Alarm')"
Hi,
When the button is in a table, you need to provide the exact key to the SetParameter method.
In case your script does not know the exact value of the key, you can use GeTablePrimaryKeys/GetTableDisplayKeys to get the entire list of keys that are part of the table. Then, try to identify the key that you need and use it in the SetParameter method.
I want to dynamically initialize the primary key if possible, so i can feed different elements with the same parameter ID in the same driver
Just use SetParameter and it will work well (FYI, SetParameter accepts both index and display key of a table, while SetParameterByPrimaryKey will only accept the index).
I’m not sure to understand what you want to do. Do you want to use same script for different elements and therefore performing SET actions on rows having different keys , and passing the key as input argument ?
If that’s the case, then you need to extend your script with Parameters ( https://docs.dataminer.services/user-guide/Advanced_Modules/Automation_module/Designing_Automation_scripts/Script_variables.html#creating-a-parameter) , and retrieve the value of the parameter in your script ( https://docs.dataminer.services/develop/api/types/Skyline.DataMiner.Automation.Engine.GetScriptParam.html )
I have created a correlation rule with specific alarm properties , and executes a specific automation script (This one) every time those alarms are detected. Upon detection and parsing of required information, it has a restart button in the component section which needs to be triggered by the SetParameter.So yes the same script will be used to dynamically find all elements affected by the alarm and execute the action on the specific component.
will there be a difference if i used setParameterByPrimaryKey or just SetParameter , I know the display key ( which is a better verification parameter for my case)