/// <summary> /// Setup the form values /// </summary> /// <param name="qc"></param> public void Setup( QueryColumn qc) { InSetup = true; MetaTable mt = null; if (qc != null) { qc.CopyCriteriaFromQueryKeyCriteria(); // sync the qc to query KeyCriteria } else // create a default qc { qc = QueryTable.GetDefaultRootQueryTable()?.KeyQueryColumn; } if (Lex.IsDefined(qc.CriteriaDisplay)) { Cids.Text = qc.CriteriaDisplay; } else if (Lex.IsDefined(qc.Criteria)) { Cids.Text = qc.Criteria; } else { Cids.Text = ""; } QueryColumn = qc; // QueryColumn instance associated with this control InSetup = false; return; }
/// <summary> /// ShowImmediate /// </summary> /// <param name="singleCorpId"></param> void ShowPopup(string singleCorpId) { KeyQc = QueryTable.GetDefaultRootQueryTable()?.KeyQueryColumn; KeyQc.Criteria = KeyQc.MetaColumnName + " = " + singleCorpId; //Tso = new TargetSummaryOptions(); //Tso.CidCriteria = "= " + singleCorpId; string title = "Spotfire View of Data for Compound Id " + CompoundId.Format(singleCorpId); BuildQuery(title); QbUtil.RunPopupQuery(Query, title, OutputDest.WinForms); return; }
/// <summary> /// Adding a new SasMap view to an existing query /// </summary> /// <param name="args"></param> /// <returns></returns> public DialogResult ShowInitialViewSetupDialog( QueryColumn sasQc, Query baseQuery) { MetaTable mt; QueryColumn qc = null; DialogResult dr; AssertMx.IsNotNull(sasQc, "SasQc"); AssertMx.IsNotNull(SasQuery, "SasMapQuery"); SasQc = sasQc; BaseQuery = baseQuery; Parms = GetParmsFromQueryColumnCriteria(SasQc); qc = BaseQuery?.GetFirstKeyColumn(); if (qc == null) { qc = QueryTable.GetDefaultRootQueryTable()?.KeyQueryColumn; } qc = qc.Clone(); Parms.KeyCriteriaQc = qc; // assign QC with undefined criteria QueryManager refQm = (baseQuery.QueryManager as QueryManager); List <string> resultsKeys = refQm?.DataTableManager?.ResultsKeys; if (resultsKeys != null && resultsKeys.Count > 0) { string listText = Csv.JoinCsvString(resultsKeys); qc.CriteriaDisplay = CidList.FormatAbbreviatedCidListForDisplay(qc, listText); qc.Criteria = qc.MetaColumn.Name + " IN (" + listText + ")"; } Parms.EndpointMc = BaseQuery?.GetFirstResultColumnByPriority(true)?.MetaColumn; // pick the highest priority result column as the default endpoint dr = Edit(); if (dr == DialogResult.OK) { StoreParmsInQueryColumnCriteria(Parms, SasQc); } return(dr); }
/// <summary> /// Get base query /// </summary> /// <returns></returns> Query GetBaseQuery() { Query bq = SessionManager.Instance.QueryBuilderQuery; if (bq == null) { bq = QueriesControl.Instance.CurrentQuery; } if (bq == null) { bq = new Query(); bq.Tables.Add(QueryTable.GetDefaultRootQueryTable()); } if (bq != null) { return(bq); } else { throw new Exception("Unable to get base query"); } }