Hello Dojo Community ! ,
I find myself at a juncture where your collective expertise would be immensely valuable. I am currently working on an automation process that comprises both a correlation rule and an automation script. While I have successfully configured the correlation rule, I am facing a challenge in the latter part of the automation script.
The objective of this automation script is to dynamically identify alarming elements and extract their parameters. Subsequently, it needs to extract specific values from another element referred to as the 'Resource Manager.' These values are crucial for a subsequent calculation, which serves as a critical condition for advancing the automation process.
To help pinpoint where the issue lies, I have implemented 'try' and 'catch' statements. However, these are temporary placeholders and will be removed once the core problem is resolved.
The primary question that I would humbly request your assistance with is whether I am employing the correct method to reference the second element ('Resource Manager') accurately. Moreover, I seek guidance on how to efficiently retrieve parameter values from this second element and carry out the necessary calculations.
If it's possible to extend the initial dynamic search mechanism to encompass the search for parameters from the second element, that would be particularly advantageous.
Your expertise and guidance in this matter would be immensely appreciated. I am eager to learn from the wealth of knowledge within the Dojo Community and resolve this challenge.
Thank you in advance for your support and insights.
Kind Regards,
A B M
Hi A B M,
for the dynamic search of the second element if I understood correctly you could get all primary keys and then loop through them to get the value you want.
string[] primaryKeys = rn.GetTablePrimaryKeys(21104);
I don't know how the table is but for the value you have here I think is wrong:
var SapIs = rm.GetParameter(21104, "Display Key [IDX]");
Because the DisplayKey or Primary Key is expected.
See the attached picture for Referance and also the code to get the value:
var SapIs = rm.GetParameter(21104, "_Total:0");
the above code will get the value from column 21104 and row with the value _Total:0
I hope this helps.
Regards
Amer
Hello Amer,
Thank you for your response. If I understand correctly, the code snippet you provided retrieves the cell within a specific row for the entire script. However, my requirement is to keep the column fixed and dynamically find the cell in a specific row based on the first element.
Regards,
A B M
Hello A B M,
You didn’t understand me correctly the code snippet above the screen shot will get you a value in fixed column 21104 in row _Total:0
The column stays a fixed value and you can dynamically change the row by getting all primary the primary keys and finding the one you want.
I will provide the full code snippet in a few minutes in a new comment
string[] primaryKeys = rn.GetTablePrimaryKeys(106);
foreach string s in primaryKeys
{
if(s ==”_Total:0″)
{
var SapIs = rn.GetParmeter(21104,s);
var SapR = rn.GetParmeter(21106,s);
if(SapIs is double sapIsValue && SapR is double sapRValue)
{
double GR = sapIsValue – sapRValue;
}
}
}
Hi Amer ,
Thank you for clarifying. At the moment , I have tested out the snippet you have provided and it prints out all the row values from the table columns.
I wanted effectively utilize the first element’s dynamic value, obtained through alarm properties, to retrieve specific cell parameters from a table in the second parent element (which is hardcoded)?
– the code snip that helps to find the alarming element
“// Find the alarming element.
Element element = engine.FindElement(dmaID, elementID);
// Checks if the element has DVEs (parent or child element).
if (element.RawInfo.IsDynamicElement)
{
// Find the Parent element which has all the DVEs components.
Element parentElement = engine.FindElement(element.RawInfo.DveParentDmaId, element.RawInfo.DveParentElementId);”
Hi Sidddique,
The reason it prints out the values is that when you do a Get Parameter it will print out the values in the logs so if you do a loop to get all the values, you will also get the print of the values in the log.
For the rest I would need to know what the dynamic value would be for example would it be a primary key value or not.
if it is not a primary key value then you would need to loop through the whole table to find the value or if you know which column it is then loop through each row of the column to get the specific parameter.
sorry for the late reply I was on vacation.
I see that this question has been inactive for some time. Do you still need assistance with this? If the question has been sufficiently answered with the answer and comments below, could you select the answer (using the ✓ icon)? Otherwise, could you still provide the additional information requested in the last comment?