{"record":{"id":"a778854fb3e96c67","repo":"pentaho/pentaho-kettle","slug":"editrowsdialog-error-errorgettingrowfordata","errorCode":null,"errorMessage":"EditRowsDialog.Error.ErrorGettingRowForData","messagePattern":"EditRowsDialog\\.Error\\.ErrorGettingRowForData","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"ui/src/main/java/org/pentaho/di/ui/core/dialog/EditRowsDialog.java","lineNumber":342,"sourceCode":"      for ( int i = 0; i < rowMeta.size(); i++ ) {\n        ValueMetaInterface valueMeta = rowMeta.getValueMeta( i );\n        ValueMetaInterface stringValueMeta = stringRowMeta.getValueMeta( i );\n\n        int colnr = i + 1;\n        if ( isDisplayingNullValue( item, colnr ) ) {\n          row[i] = null; // <null> value\n        } else {\n          String string = item.getText( colnr );\n          if ( stringValueMeta.isNull( string ) ) {\n            string = null;\n          }\n          row[i] = valueMeta.convertDataFromString( string, stringValueMeta,\n            null, null, ValueMetaInterface.TRIM_TYPE_NONE );\n        }\n      }\n      return row;\n    } catch ( KettleException e ) {\n      throw new KettleException( BaseMessages.getString( PKG, \"EditRowsDialog.Error.ErrorGettingRowForData\",\n        Integer.toString( rowNr ) ), e );\n    }\n  }\n\n  @VisibleForTesting\n  boolean isDisplayingNullValue( TableItem item, int column ) throws KettleException {\n    return GUIResource.getInstance().getColorBlue().equals( item.getForeground( column ) );\n  }\n\n  private void ok() {\n\n    try {\n      stringRowMeta = new RowMeta();\n      for ( ValueMetaInterface valueMeta : rowMeta.getValueMetaList() ) {\n        ValueMetaInterface stringValueMeta = ValueMetaFactory.cloneValueMeta( valueMeta,\n          ValueMetaInterface.TYPE_STRING );\n        stringRowMeta.addValueMeta( stringValueMeta );\n      }","sourceCodeStart":324,"sourceCodeEnd":360,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/ui/src/main/java/org/pentaho/di/ui/core/dialog/EditRowsDialog.java#L324-L360","documentation":"EditRowsDialog.getRowForData converts the grid's displayed string values back into Kettle row data using ValueMeta.convertDataFromString. If any conversion throws a KettleException (e.g. a non-numeric string in a number column, bad date format), it is rethrown as a KettleException 'EditRowsDialog.Error.ErrorGettingRowForData' with the row number.","triggerScenarios":"Editing rows in the EditRowsDialog grid and entering values that cannot be converted to the column's ValueMeta type (letters in an Integer column, malformed dates), then triggering re-read of the row (scrolling, OK, validation).","commonSituations":"Hand-editing preview/serialized row grids and typing values that violate the declared data type or format mask; locale-dependent date/number formats not matching the value meta's format.","solutions":["Correct the offending cell so its value matches the column type/format shown in the message's row number.","Enter null (empty) instead of an invalid literal if the field is optional.","Adjust the value meta format string to accept the input format being typed (e.g. set the date format mask).","Catch the KettleException where row/executesAndAssertResults is called and show the message with the rowNr to guide the user."],"exampleFix":"// before\nrow[i] = valueMeta.convertDataFromString( string, stringValueMeta, null, null, ValueMetaInterface.TRIM_TYPE_NONE );\n// after\nif ( string == null || string.trim().isEmpty() ) {\n  row[i] = null;\n} else {\n  row[i] = valueMeta.convertDataFromString( string, stringValueMeta, null, null, ValueMetaInterface.TRIM_TYPE_NONE );\n}","handlingStrategy":"validation","validationCode":"// validate cell text against the column type before committing\nif ( valueMeta.isNumeric() && !string.matches( \"-?\\\\d+(\\\\.\\\\d+)?\" ) ) {\n  throw new IllegalArgumentException( \"Value '\" + string + \"' invalid for \" + valueMeta.getTypeDesc() );\n}","typeGuard":"// ensure string is convertible before convertDataFromString\nboolean convertible;\ntry {\n  valueMeta.convertDataFromString( string, stringValueMeta, null, null, ValueMetaInterface.TRIM_TYPE_NONE );\n  convertible = true;\n} catch ( KettleException e ) {\n  convertible = false;\n}","tryCatchPattern":"try {\n  Object[] row = getRowForData( item, rowNr );\n} catch ( KettleException e ) {\n  showMessage( BaseMessages.getString( PKG, \"EditRowsDialog.Error.ErrorGettingRowForData\", Integer.toString( rowNr ) ) + \" : \" + e.getCause() );\n}","preventionTips":["Type values matching each column's declared data type and format mask.","Leave optional invalid fields empty rather than typing malformed literals.","Use consistent locale for date/number entry, or set explicit format strings."],"tags":["data-conversion","grid","value-meta","kettle"],"backgroundTag":"type-mismatch","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}