Search in sources :

Example 1 with SasInputHelper

use of org.pentaho.di.trans.steps.sasinput.SasInputHelper in project pentaho-kettle by pentaho.

the class SasInputDialog method get.

public void get() {
    try {
        // As the user for a file to use as a reference
        // 
        FileDialog dialog = new FileDialog(shell, SWT.OPEN);
        dialog.setFilterExtensions(new String[] { "*.sas7bdat;*.SAS7BDAT", "*.*" });
        dialog.setFilterNames(new String[] { BaseMessages.getString(PKG, "SASInputDialog.FileType.SAS7BAT") + ", " + BaseMessages.getString(PKG, "System.FileType.TextFiles"), BaseMessages.getString(PKG, "System.FileType.CSVFiles"), BaseMessages.getString(PKG, "System.FileType.TextFiles"), BaseMessages.getString(PKG, "System.FileType.AllFiles") });
        if (dialog.open() != null) {
            String filename = dialog.getFilterPath() + System.getProperty("file.separator") + dialog.getFileName();
            SasInputHelper helper = new SasInputHelper(filename);
            BaseStepDialog.getFieldsFromPrevious(helper.getRowMeta(), wFields, 1, new int[] { 1 }, new int[] { 3 }, 4, 5, null);
        }
    } catch (Exception e) {
        new ErrorDialog(shell, "Error", "Error reading information from file", e);
    }
}
Also used : ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) ValueMetaString(org.pentaho.di.core.row.value.ValueMetaString) FileDialog(org.eclipse.swt.widgets.FileDialog) KettleStepException(org.pentaho.di.core.exception.KettleStepException) SasInputHelper(org.pentaho.di.trans.steps.sasinput.SasInputHelper)

Aggregations

FileDialog (org.eclipse.swt.widgets.FileDialog)1 KettleStepException (org.pentaho.di.core.exception.KettleStepException)1 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)1 SasInputHelper (org.pentaho.di.trans.steps.sasinput.SasInputHelper)1 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)1