I wrote some code where I want to search the entire table for a specific content (string).
The Table is getting set as an parameter and my problem is that while I'm debugging, the table is "empty" and his members are "Timeout".. (see: Table_Members_Values.jpg)
I never experienced something similiar yet and need some help. Has anybody an idea why the table parameter isn't getting set properly?
Here is the code for the method:
Code: Select all
/// <summary>
/// Searches for a cell text inside the specified table
/// </summary>
/// <param name="cellContent">The string which should be contained in one of the cells</param>
/// <param name="table">Path for the table</param>
[UserCodeMethod]
public static bool IsCellAlreadyInTable(string cellContent, Table table)
{
Report.Log(ReportLevel.Info, table.Rows.Count.ToString());
foreach (var row in table.Rows)
{
foreach (var rowCell in row.Cells.Where(c => c.Element.GetType().Equals(typeof(Row))).Cast<Row>())
{
if (rowCell.Cells.Any(rc => rc.Text.Trim()==cellContent))
{
Report.Log(ReportLevel.Info, $"The Part Type {cellContent} already exists in the table.");
return true;
}
}
}
Report.Log(ReportLevel.Info, $"Couldn't find the Part type: {cellContent} in the table.");
return false;
}