public void getSourceColumns(ISASTaskData2 taskData) { ISASTaskDataAccessor accessor = taskData.Accessor; SASVariableSelector.AddVariableParams var_params; ISASTaskDataColumn2 data_column; accessor.Open(); for (int i = 0; i < accessor.ColumnCount; i++) { data_column = accessor.ColumnInfoByIndex(i) as ISASTaskDataColumn2; var_params = var_params = getVarParms(data_column); sasVarSelector.AddVariable(var_params); } accessor.Close(); }
// for the selected LIBNAME.MEMBER and COLUMN // get the Distinct values from the data set // This will optionally apply a format as well // if one is specified private void btnGetValues_Click(object sender, EventArgs e) { lbValues.Items.Clear(); SasColumn c = lbItems.SelectedItem as SasColumn; SasLibrary lib = lbLibraries.SelectedItem as SasLibrary; SasData d = lbMembers.SelectedItem as SasData; if (c != null && lib != null) { // Fetch distinct values using SAS format string format = ""; // get a handle to the selected data ISASTaskData2 td = Consumer.LibrefData(Consumer.AssignedServer, lib.Libref, d.Member) as ISASTaskData2; // set the format if not blank if (!string.IsNullOrEmpty(txtformat.Text)) { format = txtformat.Text; } // this can throw an exception if the // selected format does not match // the data type. try { lbValues.Items.AddRange( new List <string>( SAS.Tasks.Toolkit.Helpers.TaskDataHelpers.GetDistinctValues(Consumer, td, c.Name, format)).ToArray() ); } catch (SasDataException) { lbValues.Items.Add("<ERROR: could not fetch values>"); } } }