public GroupedTable(Database.Table table, ArrayRange range, int colToGroupFirst, int colToGroupLast, int[] colGroupOrder, SortOrder[] sortOrder)
            : base(table.Schema)
        {
            m_table = table;
            if (m_table is ExpandTable)
            {
                m_expandTable = (ExpandTable)m_table;
            }
            m_Meta = m_table.GetMetaData();
            m_GroupedColumnFirst = colToGroupFirst;
            m_GroupedColumnLast  = colToGroupLast;
            m_ColumnOrder        = colGroupOrder;
            m_SortOrder          = sortOrder;

            int sourceGroupedColumnIndex = m_ColumnOrder[colToGroupFirst];

            var col     = m_table.GetColumnByIndex(sourceGroupedColumnIndex);
            var metaCol = m_Meta.GetColumnByIndex(sourceGroupedColumnIndex);

            if (metaCol.DefaultGroupAlgorithm != null)
            {
                m_GroupCollection = metaCol.DefaultGroupAlgorithm.Group(col, range, m_SortOrder[colToGroupFirst]);
            }
            else
            {
                throw new Exception("Trying to group a column without grouping algorithm. Column '" + metaCol.Name + "' from table '" + m_table.GetName() + "'");
            }
            InitializeFromGroupCollection(col, sourceGroupedColumnIndex);
        }
        // colToGroup is an index from aNewColumnOrder.
        public GroupedTable(Database.Table table, ArrayRange range, int colToGroup, SortOrder sortOrder, FnCreateGroupTable subTable)
            : base(table.Schema)
        {
            m_table = table;
            if (m_table is ExpandTable)
            {
                m_expandTable = (ExpandTable)m_table;
            }
            m_Meta = m_table.GetMetaData();
            m_GroupedColumnFirst = 0;
            m_GroupedColumnLast  = 0;
            m_ColumnOrder        = new int[] { colToGroup };// colGroupOrder;
            m_SortOrder          = new SortOrder[1] {
                sortOrder
            };
            m_createGroupTable = subTable;

            var col     = m_table.GetColumnByIndex(colToGroup);
            var metaCol = m_Meta.GetColumnByIndex(colToGroup);

            if (metaCol.DefaultGroupAlgorithm != null)
            {
                m_GroupCollection = metaCol.DefaultGroupAlgorithm.Group(col, range, sortOrder);
            }
            else
            {
                throw new Exception("Trying to group a column without grouping algorithm. Column '" + metaCol.Name + "' from table '" + m_table.GetName() + "'");
            }
            InitializeFromGroupCollection(col, colToGroup);
        }
Ejemplo n.º 3
0
                public override ArrayRange GetIndices(Grouping.GroupCollection coll)
                {
                    DupCollection dcoll = (DupCollection)coll;

                    return(new ArrayRange(dcoll.m_sortedIndex, range));
                }