public boolean isNumeric( int index ) { return rowMeta.getValueMeta( index ).isNumeric(); }
public static Object multiply( ValueMetaInterface metaA, Object dataA, ValueMetaInterface metaB, Object dataB ) throws KettleValueException { if ( dataA == null || dataB == null ) { return null; } if ( ( metaB.isString() && metaA.isNumeric() ) || ( metaB.isNumeric() && metaA.isString() ) ) { return multiplyString( metaA, dataA, metaB, dataB ); } return multiplyNumeric( metaA, dataA, metaB, dataB ); }
public void run() { StepMeta stepMeta = transMeta.findStep( stepname ); if ( stepMeta != null ) { try { RowMetaInterface row = transMeta.getPrevStepFields( stepMeta ); // Remember these fields... for ( int i = 0; i < row.size(); i++ ) { ValueMetaInterface field = row.getValueMeta( i ); // limit the choices to only numeric input fields if ( field.isNumeric() ) { m_inputFields.put( field.getName(), Integer.valueOf( i ) ); } } setComboBoxes(); } catch ( KettleException e ) { logError( BaseMessages.getString( PKG, "UnivariateStatsDialog.Log.UnableToFindInput" ) ); } } } };
@Override public String toString() { return conversionMeta.toStringMeta() + " " + ( conversionMeta.isNumeric() ? conversionMeta.getConversionMask() + " : " + conversionMeta.getDecimalSymbol() + conversionMeta.getGroupingSymbol() : conversionMeta .isDate() ? conversionMeta.getConversionMask() : "" ); }
KettleValidatorException assertNumeric( ValueMetaInterface valueMeta, Object valueData, Validation field ) throws KettleValueException { if ( valueMeta.isNumeric() || containsOnlyDigits( valueMeta.getString( valueData ) ) ) { return null; } return new KettleValidatorException( this, field, KettleValidatorException.ERROR_NON_NUMERIC_DATA, BaseMessages.getString( PKG, "Validator.Exception.NonNumericDataNotAllowed", field.getFieldName(), valueMeta.toStringMeta() ), field.getFieldName() ); }
/** * Copy information from the input buffer to the dialog fields. */ private void getData() { for ( int i = 0; i < buffer.size(); i++ ) { RowMetaAndData rowMetaAndData = buffer.get( i ); RowMetaInterface rowMeta = rowMetaAndData.getRowMeta(); Object[] rowData = rowMetaAndData.getData(); for ( int c = 0; c < rowMeta.size(); c++ ) { ValueMetaInterface v = rowMeta.getValueMeta( c ); String show; try { if ( v.isNumeric() ) { show = v.getString( rowData[c] ); } else { show = v.getString( rowData[c] ); } } catch ( KettleValueException e ) { show = "<conversion error>"; } if ( show != null ) { wFields.table.getItem( i ).setText( c + 1, show ); } } } wFields.optWidth( true ); }
private Object getValue( ValueMetaInterface targetMeta, ValueMetaInterface strConvertMeta, Object value ) throws KettleValueException { if ( targetMeta.isNumeric() ) { try { // attempt direct conversion return targetMeta.getNativeDataType( value ); } catch ( KettleValueException e ) { if ( log.isDebug() ) { log.logDebug( e.getLocalizedMessage(), e ); } } } // convert from string String strValue = getStringValue( value ); return targetMeta.convertDataFromString( strValue, strConvertMeta, null, null, targetMeta.getTrimType() ); }
private void assertNumericForNumberMeta( ValueMetaInterface numeric, Object data ) throws Exception { assertTrue( numeric.isNumeric() ); assertNull( validator.assertNumeric( numeric, data, new Validation() ) ); }
if ( v.getType() != argumentType[i] && !( v.isNumeric() && ValueMetaBase.isNumeric( argumentType[i] ) ) ) { error_found = true; error_message +=
if ( valueMeta.isNumeric() ) {
if ( val.isNumeric() && ( length > 18 || precision > 18 ) ) { val = new ValueMetaBigNumber( name );
for ( int i = 0; i < rowMeta.size(); i++ ) { ValueMetaInterface v = rowMeta.getValueMeta( i ); colinf[i] = new ColumnInfo( v.getName(), ColumnInfo.COLUMN_TYPE_TEXT, v.isNumeric() ); colinf[i].setToolTip( v.toStringMeta() ); colinf[i].setValueMeta( v );
for ( int i = 0; i < rowMeta.size(); i++ ) { ValueMetaInterface v = rowMeta.getValueMeta( i ); colinf[i] = new ColumnInfo( v.getName(), ColumnInfo.COLUMN_TYPE_TEXT, v.isNumeric() ); colinf[i].setToolTip( v.toStringMeta() ); colinf[i].setValueMeta( v );
for ( int i = 0; i < rowMeta.size(); i++ ) { ValueMetaInterface v = rowMeta.getValueMeta( i ); colinf[i] = new ColumnInfo( v.getName(), ColumnInfo.COLUMN_TYPE_TEXT, v.isNumeric() ); colinf[i].setToolTip( v.toStringMeta() ); colinf[i].setValueMeta( v );
if ( valueMeta.isDate() ) { valueMeta.setConversionMask( "yyyy-MM-dd HH:mm:ss" ); } else if ( valueMeta.isNumeric() ) { valueMeta.setDecimalSymbol( "." ); valueMeta.setGroupingSymbol( "" );
case GroupByMeta.TYPE_GROUP_CUMULATIVE_SUM: case GroupByMeta.TYPE_GROUP_CUMULATIVE_AVERAGE: if ( subjMeta.isNumeric() ) { try { vMeta = ValueMetaFactory.createValueMeta( meta.getAggregateField()[ i ], subjMeta.getType() );
case MemoryGroupByMeta.TYPE_GROUP_SUM: case MemoryGroupByMeta.TYPE_GROUP_AVERAGE: vMeta = !compatibilityMode && subjMeta.isNumeric() ? subjMeta.clone() : new ValueMetaNumber(); vMeta.setName( meta.getAggregateField()[i] ); break;
if ( valueMeta.isNumeric() ) { originMeta.setDecimalSymbol( "." ); originMeta.setGroupingSymbol( null );
public boolean tableItemInserted( TableItem tableItem, ValueMetaInterface v ) { if ( v.isNumeric() ) {
} else if ( sourceMeta.isNumeric() && meta.getFieldFormatType()[i] == MySQLBulkLoaderMeta.FIELD_FORMAT_TYPE_NUMBER ) { data.bulkFormatMeta[i] = data.bulkNumberMeta.clone();