Beispiel #1
0
        /// <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;
        }