Hello everyone, i have the ids of the PK(7021) and the Display Key(7020) columns, but i want to validate other fields of the row(check if a data already exist). Whats the best way to access the column data in a regular Element(not from class IDmaElement)? I need to get all colmun value for "Job ID" to verify if it already has the value that i'm generating.
My table Id is 7000.
Column i want to access is the Job Id(7001).
element.GetParameter(7000, 7001) - Every time i get the return "Object reference not set to an instance of an object. (Script 'MediaPulse API Test')".
element.GetParameterDisplay(7001, "1") - Every time i get the return "Not initialized (Script 'MediaPulse API Test')".
My Table:
Hi Miguel, i have tried this way and keep gatting the "Object reference not set to an instance of an object. (Script 'MediaPulse API Test')" error. My code line is: var param = element.GetParameterByPrimaryKey(7001, "7021").ToString(); engine.GenerateInformation(param);
Hi Joao,
You can use the GetParameterByPrimaryKey(). The issue is that "7021" is not the primary key (PK) value. The value we need is the one found in the Instance column cell, like this:
element.GetParameterByPrimaryKey(7001, "10eb2c9-977a...");
Let me know how it goes.
Hi German, thank you for your rensponse, it helped me getting the row value and verifie it, but i need a way to get all column values(it was another problemn i'm trying to solve, but without success) to verify if already has a Job Id with the number i'm generating. Can you help with it too?
Hi Joao, If you want to retrieve the row, you can use the Skyline.DataMiner.Core.DataMinerSystem.Automation NuGet to generate the IDms variable. Here's the code:
var dms = engine.GetDms();
var dmsElement = dms.GetElement("elementName");
var tableRow = dmsElement.GetTable(tableId).GetRow("10eb2c9-977a…");
With this, you can retrieve the table row associated with the rowId you're setting.
We're using this line "Element element = engine.FindElement("MediaPulse API Interface");", with this, we cannot use the GetTable() and GetRow() method, but we're using others methos that only works with "Element element". Do you know how to do it without change the element variable type? If there is no way, i'll try looking to change for the dms class.
The Element class doesn’t have an option to retrieve a table row. Therefore, I suggest using the IDms class, which will provide the row data as an object array.
Ok, thank you German, for your time and help!
Hi Joao,
I am not sure if there is a way to retrieve the full row from a table, but have you checked using GetParamterByPrimaryKey?
https://docs.dataminer.services/develop/api/types/Skyline.DataMiner.Automation.Element.GetParameterByPrimaryKey.html#Skyline_DataMiner_Automation_Element_GetParameterByPrimaryKey_System_Int32_System_String_