/// <summary> /// InitializeMapForDev /// </summary> /// <param name="dm"></param> void InitializeMapForDev(DataTableMapMsx dm) { QueryTable qt = null; QueryColumn qc = null; string alias = ""; string colName = ""; if (dm.ColumnMapCollection != null && dm.ColumnMapCollection.Count > 0) { return; } dm.ColumnMapCollection = new ColumnMapCollection(); DataTableMsx dt = SVP.Doc.DataManager.TableCollection[0]; dm.SpotfireDataTable = dt; foreach (DataColumnMsx dc in dt.Columns) { colName = dc.Name; int i1 = colName.IndexOf("."); if (i1 <= 0 || i1 + 1 >= colName.Length) // name without alias { alias = "T1"; } else { alias = colName.Substring(0, i1); colName = colName.Substring(i1 + 1); } int qti = Query.GetQueryTableIndexByAlias(alias); if (qti < 0) { continue; } qt = Query.Tables[qti]; qc = qt.GetQueryColumnByLabel(colName); if (qc == null) { continue; } ColumnMapMsx cm = new ColumnMapMsx(); cm.QueryColumn = qc; cm.SpotfireColumn = dc; cm.SpotfireColumnName = dc.Name; cm.Role = dc.Name; dm.ColumnMapCollection.Add(cm); } return; }
void AddSortInfo( SortInfoCollectionMsx sic, string col, SortOrderMsx sortType) { if (!Lex.IsDefined(col)) { return; } SortInfoMsx si = new SortInfoMsx(); si.DataColumnReferenceSerializedId = col; DataTableMsx dt = V.DataTable; if (dt == null) { dt = Api?.Document?.ActiveDataTableReference; } if (dt != null) { si.DataColumnReference = dt.GetColumnByName(col); } si.SortOrder = sortType; sic.SortList.Add(si); return; }
/// <summary> /// Setup /// </summary> /// <param name="v"></param> public void Setup( VisualMsx v, SpotfireViewManager svm, EventHandler callerEditValueChangedEventHandler = null) { DataTableMsx mainDataTable = v?.Data?.DataTableReference; SVM = svm; MainDataTableSelectorControl.Setup(mainDataTable, SVP, callerEditValueChangedEventHandler); CallerEditValueChangedEventHandler = callerEditValueChangedEventHandler; return; }
/// <summary> /// New Datatable selected /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainDataTableSelectorControl_EditValueChanged(object sender, EventArgs e) { if (InSetup) { return; } DataTableMsx dt = MainDataTableSelectorControl.SelectedDataTable; Visual.Data.DataTableReference = dt; // update document EditValueChanged(); }
public DataTableMsx SelectedDataTable = null; // Currently selected data table //{ // get { return _selectedDataTable; } // set // { // _selectedDataTable = value; // if (Lex.IsUndefined(_selectedDataTable?.Name)) // { // TableNameDropDown.Text = ""; // } // else // { // TableNameDropDown.Text = _selectedDataTable.Name; // set control text as well // } // } //} //DataTableMsx _selectedDataTable = null; /// <summary> /// Setup control /// </summary> /// <param name="query"></param> public void Setup( DataTableMsx selectedDataTable, SpotfireViewProps svp, EventHandler editValueChangedEventHandler = null) { SelectedDataTable = selectedDataTable; TableNameDropDown.Text = selectedDataTable?.Name; SVP = svp; EditValueChanged = editValueChangedEventHandler; return; }
/// <summary> /// Setup /// </summary> /// <param name="v"></param> public void Setup( VisualMsx v, SpotfireViewProps svp, EventHandler valueChangedCallback = null) { InSetup = true; Visual = v; SVP = svp; DataTableMsx mainDataTable = v?.Data?.DataTableReference; MainDataTableSelectorControl.Setup(svp.Doc.Doc_Tables.TableList, mainDataTable, SVP, MainDataTableSelectorControl_EditValueChanged); ValueChangedCallback = valueChangedCallback; InSetup = false; return; }
/// <summary> /// New QueryTable to map to selected /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void QueryTableAssignmentChanged(object sender, EventArgs e) { if (InSetup) return; CurrentMap.QueryTable = QtSelectorControl.SelectedQueryTable; if (QtSelectorControl.IsMapped) { CurrentMap.AssignInitialMappingForQueryTable(CurrentMap.QueryTable); SVM.ImportMobiusDataFile(CurrentMap); // update spotfire view accordingly //SVM.MergeMobiusDataFileAndRemapDataTable(CurrentMap); // update spotfire view accordingly } else // not mapped, restore original table def { CurrentMap.Clear(); DataTableMsx dt = SVM.SpotfireApiClient.ResetDataTable(CurrentMap.SpotfireDataTable); CurrentMap.InitializeMapForDataTable(dt); } UpdateFieldGridDataTable(); return; }
/// <summary> /// TableMenu item cliced /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TableMenuItem_Click(object sender, EventArgs e) { SelectedDataTable = (sender as ToolStripMenuItem).Tag as DataTableMsx; TableNameDropDown.Text = SelectedDataTable?.Name; MenuItemSelected = true; }
/// <summary> /// Setup the dropdown for a Column(s) expression /// </summary> /// <param name="parsedColExpr"></param> /// <param name="axis"></param> /// <param name="visual"></param> /// <param name="b"></param> /// <param name="parentColumnExressionSelectorControl"></param> /// <param name="callerEditValueChanged"></param> public void Setup( ParsedColumnExpressionMsx parsedColExpr, AxisMsx axis, VisualMsx visual, DropDownButton b, ColumnsSelector parentColumnExressionSelectorControl, EventHandler callerEditValueChanged = null) { InSetup = true; ParsedColExpr = parsedColExpr; Axis = axis; Visual = visual; InvokingButton = b; PC = parentColumnExressionSelectorControl; SVM = PC.SVM; CallerEditValueChanged = callerEditValueChanged; DataTableMsx dt = GetSelectorDataTable(); if (dt != null) { TableSelector.Name = dt.Name; } else { TableSelector.Name = ""; } List <DataTableMsx> tables = Axis.GetAllowedDataTables(); ColumnList.Items.Clear(); string selectedColName = null; if (parsedColExpr.ColumnNames.Count > 0) { selectedColName = parsedColExpr.ColumnNames[0]; } foreach (DataColumnMsx col in dt.Columns) { CheckedListBoxItem item = new CheckedListBoxItem(); item.Description = col.Name; if (Lex.Eq(col.Name, selectedColName)) { item.CheckState = CheckState.Checked; } ColumnList.Items.Add(item); } //DataMapControl.ShowSelectedColumnCheckBoxes = true; //DataMapControl.SelectSingleColumn = true; //DataMapControl.ShowTableControls = false; //DataMapControl.Setup(SVM, DataMapSelectedColumnChanged); ////DataMapControl.MobiusTableNameCol.Visible = false; ////DataMapControl.MobiusColNameCol.Visible = false; //DataMapControl.FieldGridView.OptionsView.ColumnAutoWidth = false; ////DataMapControl.FieldGridView.OptionsView.ShowColumnHeaders = false; InSetup = false; return; }