How to get in all rows with values for a table paramater via automation script?


How to use this method? any code sample
In my code I want to get like a table data for specific column in table

Thanks to Samuel you already have a sample
Hi Apurva,
One possible solution is to use the QueryData method with a ColumnFilter from the IDmsTable interface.
Below is a small snippet demonstrating how to use this method.
IDms dms = engine.GetDms();
IDmsElement element = dms.GetElement(/*Element Name*/);
IDmsTable table = element.GetTable(/*Table PID*/);ColumnFilter[] columnFilters = new[] {
new ColumnFilter{ Pid = /*Column PID*/, Value = /*value to compare*/, ComparisonOperator = ComparisonOperator.Equal},
};List<object[]> rows = table.QueryData(columnFilters);

Hi Thanks,
But I want like I have column PID, and there are many rows int he table
So how can I retrieve all the rows values:
IDmsTable table = elementData.GetTable(Convert.ToInt32(paramTableId));
ColumnFilter[] columnFilters = new[] {
new ColumnFilter{ Pid = Convert.ToInt32(tableColumnParamId)},
};
var rows = table.QueryData(columnFilters).ToArray();
I want data of all rows but of that column as I am passing my PID one by one, I see it brings all data (rows[0][2].ToString()) and is hard to get. Since I have column filter it should brinf data of only those columns
I dont know where my column is placed so cant send index juts the PID I can
Hi Apurva,
So, just to confirm your use case, you want to retrieve all values for a specific column?

Yes, all values for column for whatever rows are there
Row 1 -> Column 1 data
Row 2 -> Column 1 data and so on
And is calling again and again in loop as its dynamic configuration we have made , wont it impact performance
With only the column PID, I believe this is the only way to retrieve the column's values.
IDms dms = Engine.GetDms();
IDmsElement element = dms.GetElement(/*Element Name*/);
IDmsTable table = element.GetTable(/*Table PID*/);
var primaryKeys = table.GetPrimaryKeys();
IDmsColumn<string> column = table.GetColumn<string>(/*Column PID*/);
Dictionary<string, string> columnValues = new Dictionary<string, string>();
foreach (var primaryKey in primaryKeys)
{
columnValues[primaryKey] = column.GetValue(primaryKey, KeyType.PrimaryKey);
}
Hi Apurva,
can you check if you can use GetTable:
https://docs.dataminer.services/develop/api/types/Skyline.DataMiner.Core.DataMinerSystem.Common.IDmsElement.GetTable.html
and then some method of your choice from here: https://docs.dataminer.services/develop/api/types/Skyline.DataMiner.Core.DataMinerSystem.Common.IDmsTable.html