Hi Dojo,
I need to grab multiple parameters across multiple tables belonging to an Element, wondering what is the most efficient manner to go about this given I have the column/parameter ID and primary key? Are there any asynchronous methods that can be used? Currently using a series of synchronous Element.GetParameterByPrimaryKey method calls and it is currently the hotspot in my Automation script.
Thanks!
Hi Vish,
You could use GetRow or GetColumn functions as shown in the example below.
Note, you'll need to add the Skyline.DataMiner.Core.DataMinerSystem.Common and Skyline.DataMiner.Core.DataMinerSystem.Automation nugets to your solution to use these functions.
e.g.
using Skyline.DataMiner.Automation;
using Skyline.DataMiner.Core.DataMinerSystem.Common;
using Skyline.DataMiner.Core.DataMinerSystem.Automation;/// <summary>
/// Represents a DataMiner Automation script.
/// </summary>
public class Script
{
/// <summary>
/// The script entry point.
/// </summary>
/// <param name="engine">Link with SLAutomation process.</param>
public void Run(IEngine engine)
{
IDms idms = engine.GetDms();var myElement = idms.GetElement("test element");
var myTable = myElement.GetTable(96);var myRow = myTable.GetRow("winlogon:0");
foreach (var cell in myRow)
{
engine.GenerateInformation(cell.ToString());
}
}
}
Thanks Ive for the prompt response.
I should have specified that these parameters are across different tables – unsure whether that would change your suggestion. Also with your suggested solution how can I link each cell in myRow with its corresponding column name/id?
Hi Vish,
If you only need one cell from every table, then I would stick with the getparameterbyprimarykey.
As soon as you need multiple values I would go for the GetRow or GetColumn methods.
The GetRow() call returns an object array, where the index in the array is the idx of the column as specified in the protocol. I’m not aware of any other way to extract the column name through iDms.
FYI: myTable.GetRows() will retrieve all rows at once