Exemplo n.º 1
0
		/// <summary>
		/// Fill the field grid with current mappings
		/// </summary>

		internal void UpdateFieldGridDataTable()
		{
			DataRow dr;
			DataColumn dc;
			MetaColumnType mcType = MetaColumnType.Unknown;

			bool excludeNoRoleColumns = false; // if true don't include columns that don't have a role from the initial template analysis file

			InSetup = true;

			DataTable dt = FieldDataTable;
			dt.Clear();

			if (CurrentMap != null)
				foreach (ColumnMapMsx cm in CurrentMap.ColumnMapList)
				{
					if (excludeNoRoleColumns && Lex.IsUndefined(cm.Role)) continue;

					dr = dt.NewRow();

					QueryColumn qc = cm.QueryColumn;

					if (qc != null) // column is mapped
					{
						dr["MobiusTableNameField"] = qc.QueryTable.ActiveLabel;
						dr["MobiusColNameField"] = qc.ActiveLabel;
						mcType = qc.MetaColumn.DataType;
					}

					else // no query column assigned, get type image from spotfire if including these
					{
						mcType = DataTableMapMsx.GetMatchingMobiusDataTypeFromSpotfireColumn(cm.SpotfireColumn);
					}

					int imgIdx = (int)MetaColumn.GetMetaColumnDataTypeImageIndex(mcType);
					if (mcType == MetaColumnType.CompoundId) imgIdx = (int)Bitmaps16x16Enum.Key;
					dr["DataTypeImageField"] = Bitmaps.Bitmaps16x16.Images[imgIdx];

					dr["SpotfireColNameField"] = cm.SpotfireColumnName;
					dr["OriginalSpotfireColNameField"] = cm.Role;

					dr["SelectedField"] = cm.Selected;

					dr["ColumnMapMsxRefField"] = cm; // store Field ref
					dt.Rows.Add(dr);
				}

			Changed = false;
			InSetup = false;
			return;
		}