BuildVariableParamsList(SasData data) { // Allocate the list List <SASVariableSelector.AddVariableParams> parmList = new List <SASVariableSelector.AddVariableParams>(); foreach (SasColumn col in data.GetColumns()) { SASVariableSelector.AddVariableParams parms = new SASVariableSelector.AddVariableParams(); // populate the column properties // from the SasColumn entry parms.Name = col.Name; parms.Label = col.Label; parms.Format = col.Format; parms.Informat = col.Informat; // map the column category // to the variable selector // version of this enumeration // Ensures the correct "type" icon is // shown in the variable selector switch (col.Category) { case SasColumn.eCategory.Character: parms.Type = VARTYPE.Character; break; case SasColumn.eCategory.Numeric: parms.Type = VARTYPE.Numeric; break; case SasColumn.eCategory.Currency: parms.Type = VARTYPE.Currency; break; case SasColumn.eCategory.Date: parms.Type = VARTYPE.Date; break; case SasColumn.eCategory.DateTime: parms.Type = VARTYPE.Time; break; case SasColumn.eCategory.Georef: parms.Type = VARTYPE.GeoRef; break; default: parms.Type = VARTYPE.Numeric; break; } // add the complete object to the list // to return parmList.Add(parms); } return(parmList); }
/// <summary> /// Build a List of AddVariableParams that can be added /// to the SAS Variable Selector control /// </summary> /// <param name="data">A SasData object for the input data used /// in the variable selector</param> /// <returns>A list of AddVariableParams objects that /// can be added to the control</returns> public static List<SASVariableSelector.AddVariableParams> BuildVariableParamsList(SasData data) { // Allocate the list List<SASVariableSelector.AddVariableParams> parmList = new List<SASVariableSelector.AddVariableParams>(); foreach (SasColumn col in data.GetColumns()) { SASVariableSelector.AddVariableParams parms = new SASVariableSelector.AddVariableParams(); // populate the column properties // from the SasColumn entry parms.Name = col.Name; parms.Label = col.Label; parms.Format = col.Format; parms.Informat = col.Informat; // map the column category // to the variable selector // version of this enumeration // Ensures the correct "type" icon is // shown in the variable selector switch (col.Category) { case SasColumn.eCategory.Character: parms.Type = VARTYPE.Character; break; case SasColumn.eCategory.Numeric: parms.Type = VARTYPE.Numeric; break; case SasColumn.eCategory.Currency: parms.Type = VARTYPE.Currency; break; case SasColumn.eCategory.Date: parms.Type = VARTYPE.Date; break; case SasColumn.eCategory.DateTime: parms.Type = VARTYPE.Time; break; case SasColumn.eCategory.Georef: parms.Type = VARTYPE.GeoRef; break; default: parms.Type = VARTYPE.Numeric; break; } // add the complete object to the list // to return parmList.Add(parms); } return parmList; }
private SASVariableSelector.AddVariableParams getVarParms(ISASTaskDataColumn colInfo) { SASVariableSelector.AddVariableParams var_params = new SASVariableSelector.AddVariableParams(); var_params.Name = colInfo.Name; var_params.Label = colInfo.Label; var_params.Format = colInfo.Format; var_params.Informat = colInfo.Informat; var_params.MaxLength = colInfo.Length; if (colInfo.Group == VariableGroup.Character) { var_params.Type = VARTYPE.Character; } else { var_params.Type = VARTYPE.Numeric; } return(var_params); }