Hi all,
I was wondering if someone could help me understand why the below code is not working:
int notPolledCount = protocol.playoutchanneltable.Where(x => Convert.ToDouble(x.Playoutchannellastpolling_1004) == -1.25).Count();
or
foreach(PlayoutchanneltableQActionRow row in protocol.playoutchanneltable)
{
string test = Convert.ToString(row.Playoutchannelchannelname_1002);
}
Both cases will result in an System.InvalidCastException and I just would like to understand if that is intended behavior and the looping through table rows is not possible with these classes or if I am maybe missing something.
Thanks in advance!
Best regards
Manuel
Hello Manuel,
Doing protocol.tablename doesn't represent an internal call to get the table from the element.
In your case, I would recommend doing a GetColumn on the column you need (1002) and then doing the count required.
Hi Manuel,
your code snippets should actually work but currently throws an InvalidCastException due to an issue in the implemention of the QActionTableEnumerator class. I created an task for this: https://collaboration.dataminer.services/task/185850.
Note, however, as Pedro Almeida mentions, in your use case performing a GetColumn call would be a more performant implementation: the iterator would retrieve the table rows one by one from SLProtocol by performing a GetRow behind the scenes. By doing a GetColumn call, only a single call to retrieve the data from SLProtocol is needed and it only returns the column data, whereas in the other approach the entire row is retrieved to then just use that single column.
Hi Pedro,
understood. Many thanks for your Input!!!