コード例 #1
0
        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);
        }
コード例 #2
0
        private void LoadColumns()
        {
            cmbReport.Items.Add(selectReportPrompt);
            cmbMeasure.Items.Add(selectMeasurePrompt);

            try
            {
                // to populate the comboboxes with the available columns,
                // we have to examine the active data source.
                ISASTaskData         data = Model.Consumer.ActiveData;
                ISASTaskDataAccessor da   = data.Accessor;
                // to do that, we need to "open" the data to get a peek at the column
                // information
                if (da.Open())
                {
                    for (int i = 0; i < da.ColumnCount; i++)
                    {
                        // first add the most likely categories -- character and date columns
                        ISASTaskDataColumn ci = da.ColumnInfoByIndex(i);
                        if (ci.Group == VariableGroup.Character || ci.Group == VariableGroup.Date)
                        {
                            cmbReport.Items.Add(ci.Name);
                            cmbCategory.Items.Add(ci.Name);
                        }
                        else
                        {
                            cmbMeasure.Items.Add(ci.Name);
                            hashFormats.Add(ci.Name, ci.Format);
                        }
                    }

                    // now add the rest of the numerics for Report and Category.
                    // These are less likely to make sense, but we don't want to
                    // shut the door on "creative" reports.
                    for (int i = 0; i < da.ColumnCount; i++)
                    {
                        ISASTaskDataColumn ci = da.ColumnInfoByIndex(i);
                        if (ci.Group == VariableGroup.Numeric)
                        {
                            cmbReport.Items.Add(ci.Name);
                            cmbCategory.Items.Add(ci.Name);
                        }
                    }

                    cmbCategory.Items.Add(noCategory);

                    da.Close();
                }
                else
                {
                    // something went wrong in trying to read the data, so
                    // report an error message and end the form.
                    string dataname = "UNKNOWN";
                    if (Model.Consumer.ActiveData != null)
                    {
                        dataname = string.Format("{0}.{1}", Model.Consumer.ActiveData.Library, Model.Consumer.ActiveData.Member);
                    }
                    MessageBox.Show(string.Format("ERROR: Could not read column information from data {0}.", dataname));
                    this.Close();
                }
            }
            catch
            {
                // log exception
            }
        }