Beispiel #1
0
        /// <summary>
        /// If the user selected a field from a non-summarized table, give them the option to replace it with the field from the
        /// summarized table (if available).  Performance is better. This will also avoid extra rows as well as a cartesian product.
        /// </summary>

        private void CheckForSummarizedVersionOfMetaColumn()
        {
            return;

#if false // disabled for now
            if (SelectedColumn == null || SelectedColumn.QueryColumn == null)
            {
                return;
            }

            QueryColumn qc = SelectedColumn.QueryColumn;
            MetaColumn  mc = qc.MetaColumn;
            MetaTable   mt = mc.MetaTable;
            QueryTable  qt = new QueryTable(mt);

            bool unsummarrizedVersionSelected = (!mt.UseSummarizedData && mt.SummarizedExists);
            if (!unsummarrizedVersionSelected)
            {
                return;
            }

            QueryTable  summarizedQt = qt.AdjustSummarizationLevel(useSummarized: true);
            QueryColumn summarizedQc = summarizedQt.GetQueryColumnByName(qc.ActiveLabel);
            if (summarizedQc == null)
            {
                return;
            }

            string msg =
                "You have selected the un-summarized version of " + qc.ActiveLabel + ".\n" +
                "Using the summarized version will result in better performance and avoid unwanted extra rows.\n" +
                "It is recommended that the summarized version be used for calculated fields.\n\n" +
                "Would you like to use the summarized version instead?\n";

            DialogResult dialogResult = MessageBoxMx.Show(msg, "Summarized Data Available!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (dialogResult == DialogResult.Yes)
            {
                SelectedColumn = null                 //summarizedQc.MetaColumn;

                                 return;
            }
#endif
        }