Database.Table FilterTable(Database.Table table, long row, List <Database.View.Where.Builder> tableFilterWhere) { var tableFilterWhereUnion = new Database.View.WhereUnion(tableFilterWhere, null, null, null, null, m_UIState.snapshotMode.SchemaToDisplay, table, null); var indices = tableFilterWhereUnion.GetMatchingIndices(row); return(new Database.Operation.IndexedTable(table, new ArrayRange(indices))); }
void OpenLinkRequest(Database.LinkRequestTable link, bool focus) { //TODO this code is the same as the one inSpreadsheetPane, should be put together UIElementsHelper.SetVisibility(VisualElements[2], m_ActiveMode.snapshot.nativeAllocationSites.Count > 0 && m_CurrentTableView == TableDisplayMode.Allocations); var tableRef = new Database.TableReference(link.LinkToOpen.TableName, link.Parameters); var table = m_ActiveMode.SchemaToDisplay.GetTableByReference(tableRef); if (table == null) { UnityEngine.Debug.LogError("No table named '" + link.LinkToOpen.TableName + "' found."); return; } if (link.LinkToOpen.RowWhere != null && link.LinkToOpen.RowWhere.Count > 0) { Database.Table filteredTable = table; if (table.GetMetaData().defaultFilter != null) { filteredTable = table.GetMetaData().defaultFilter.CreateFilter(table); } Database.Operation.ExpressionParsingContext expressionParsingContext = null; if (link.SourceView != null) { expressionParsingContext = link.SourceView.ExpressionParsingContext; } var whereUnion = new Database.View.WhereUnion(link.LinkToOpen.RowWhere, null, null, null, null, m_ActiveMode.SchemaToDisplay, filteredTable, expressionParsingContext); var indices = whereUnion.GetMatchingIndices(link.SourceRow); var newTab = new Database.Operation.IndexedTable(table, new ArrayRange(indices)); OpenTable(tableRef, newTab, focus); } else { OpenTable(tableRef, table, new Database.CellPosition(0, 0), focus); } }
public bool OpenLinkRequest(Database.LinkRequestTable link, Database.TableReference tableLink, Database.Table table) { using (ScopeDebugContext.String("OpenLinkRequest")) { if (link.LinkToOpen.RowWhere != null && link.LinkToOpen.RowWhere.Count > 0) { Database.Table filteredTable = table; if (table.GetMetaData().defaultFilter != null) { filteredTable = table.GetMetaData().defaultFilter.CreateFilter(table); } var whereUnion = new Database.View.WhereUnion(link.LinkToOpen.RowWhere, null, null, null, null, m_UIState.CurrentMode.GetSchema(), filteredTable, link.SourceView == null ? null : link.SourceView.ExpressionParsingContext); long rowToSelect = whereUnion.GetIndexFirstMatch(link.SourceRow); if (rowToSelect < 0) { DebugUtility.LogWarning("Could not find entry in target table '" + link.LinkToOpen.TableName + "'"); return(false); } DebugUtility.DebugLog("Opening table '" + link.LinkToOpen.TableName + "' at row " + rowToSelect); OpenTable(tableLink, table, new Database.CellPosition(rowToSelect, 0)); } else { OpenTable(tableLink, table, new Database.CellPosition(0, 0)); } return(true); } }