示例#1
0
        private void FieldsButton_Click(object sender, EventArgs e)
        {
            Query      q;
            QueryTable qt, qt2;

            string advExprExt;
            Point  p = FieldsButton.PointToScreen(new Point(0, FieldsButton.Height));

            FieldSelectorControl.Query      = AdvancedEditorPseudoQuery;
            FieldSelectorControl.MetaColumn = null;           // no current selection

            int p1 = AdvancedExpr.SelectionStart;             // save position/selection since may change
            int p2 = AdvancedExpr.SelectionLength;

            Mobius.Data.QueryColumn qc = FieldSelectorControl.ShowMenu(p);
            if (qc == null)
            {
                return;
            }
            MetaColumn mc = qc.MetaColumn;

            string tok = '"' + mc.MetaTable.Name + "." + mc.Label + '"';

            InsertText(tok, p1, p2);

            qt2 = AdvancedEditorPseudoQuery.GetQueryTableByName(mc.MetaTable.Name);
            if (qt2 == null)
            {
                AdvancedEditorPseudoQuery.AddQueryTable(qc.QueryTable);
            }
        }
示例#2
0
/// <summary>
/// Add a new pivot grid field
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

        private void AddPivotField_Click(object sender, EventArgs e)
        {
            QueryManager qm = PivotView.Qm;
            Query        q  = qm.Query;

            FieldSelectorControl.Query      = q;
            FieldSelectorControl.MetaColumn = null;
            Point p = AddPivotField.PointToScreen(new Point(0, AddPivotField.Height));

            Mobius.Data.QueryColumn qc = FieldSelectorControl.ShowMenu(p);
            if (qc == null)
            {
                return;
            }

            PivotGridPropertiesMx pp = PivotView.PivotGridPropertiesMx;

            ResultsField rfld = qm.ResultsFormat.GetResultsField(qc);

            if (rfld == null)
            {
                return;
            }

            PivotGridFieldMx field =             // add new field (must add to base view)
                                     PivotGridView.AddField(rfld, pp.PivotFields, null, GroupingTypeEnum.EqualValues);

            PivotGridFieldMx field2 = new PivotGridFieldMx();

            field.CopyField(field2);
            pp.PivotFields.Remove(field);             // remove from base view

            PivotGrid.BeginUpdate();
            object ds = PivotGrid.DataSource;

            PivotGrid.DataSource = null;
            PivotGrid.Fields.Add(field2);             // add to pivot grid
            PivotView.ConfigurePivotGridControlField(field2);
            PivotGrid.DataSource = ds;
            PivotGrid.EndUpdate();

            FillFieldDetailsGrid();
            return;
        }