{"record":{"id":"9a42bec6a58aff15","repo":"pentaho/pentaho-kettle","slug":"fields-must-be-defined-to-do-a-preview","errorCode":null,"errorMessage":"Fields must be defined to do a preview","messagePattern":"Fields must be defined to do a preview","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/palo/core/src/main/java/org/pentaho/di/ui/trans/steps/palo/cellinput/PaloCellInputDialog.java","lineNumber":509,"sourceCode":"    for ( int i = 0; i < tableViewFields.table.getItemCount(); i++ ) {\n      DimensionField field =\n        new DimensionField( tableViewFields.table.getItem( i ).getText( 1 ), tableViewFields.table.getItem( i )\n          .getText( 2 ), tableViewFields.table.getItem( i ).getText( 3 ) );\n      fields.add( field );\n    }\n    myMeta.setDatabaseMeta( transMeta.findDatabase( addConnectionLine.getText() ) );\n    myMeta.setCubeMeasureName( new DimensionField( \"Measure\", textMeasureName.getText(), comboMeasureType.getText() ) );\n    myMeta.setLevels( fields );\n    myMeta.setCube( comboCube.getText() );\n    myMeta.setChanged( true );\n  }\n\n  private void preview() {\n    PaloCellInputMeta oneMeta = new PaloCellInputMeta();\n    try {\n      getInfo( oneMeta );\n      if ( oneMeta.getFields() == null || oneMeta.getFields().size() == 0 ) {\n        throw new KettleException( \"Fields must be defined to do a preview\" );\n      } else {\n        for ( DimensionField field : oneMeta.getFields() ) {\n          if ( Utils.isEmpty( field.getFieldType() ) ) {\n            throw new KettleException( \"All fields must have an output type to do the preview\" );\n          }\n        }\n      }\n    } catch ( KettleException e ) {\n      new ErrorDialog( shell, BaseMessages.getString( PKG, \"RowGeneratorDialog.Illegal.Dialog.Settings.Title\" ),\n        BaseMessages.getString( PKG, \"RowGeneratorDialog.Illegal.Dialog.Settings.Message\" ), e );\n      return;\n    }\n\n    TransMeta previewMeta =\n      TransPreviewFactory.generatePreviewTransformation( transMeta, oneMeta, textStepName.getText() );\n\n    EnterNumberDialog numberDialog =\n      new EnterNumberDialog( shell, 500, BaseMessages.getString( PKG, \"System.Dialog.EnterPreviewSize.Title\" ),","sourceCodeStart":491,"sourceCodeEnd":527,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/palo/core/src/main/java/org/pentaho/di/ui/trans/steps/palo/cellinput/PaloCellInputDialog.java#L491-L527","documentation":"In PaloCellInputDialog.preview(), after copying dialog settings into a fresh PaloCellInputMeta via getInfo(), the code validates that at least one field is defined; an empty fields list throws 'Fields must be defined to do a preview'. This is a pure pre-flight validation before running the preview transformation.","triggerScenarios":"Clicking Preview in the Palo Cell Input dialog while the fields table has no rows (getFields() null or size 0).","commonSituations":"User clicked Preview before filling in the dimension fields grid; fields were deleted but Preview clicked anyway; getInfo() failed to map the grid contents into the meta.","solutions":["Add at least one dimension field row in the fields table before clicking Preview","Give each field an output type (otherwise the sibling 'All fields must have an output type' error fires)","Save and reopen the dialog if the grid contents seem lost, then re-enter fields"],"exampleFix":"// before\nfields table: [] // clicked Preview\n// after\nfields table: [{ fieldName: 'Year', fieldType: 'String' }]","handlingStrategy":"validation","validationCode":"if (meta.getFields() == null || meta.getFields().size() == 0) {\n  throw new KettleException(\"Define at least one field before preview\");\n}\nfor (DimensionField f : meta.getFields()) {\n  if (Utils.isEmpty(f.getFieldType())) throw new KettleException(\"Field \" + f.getFieldName() + \" needs an output type\");\n}","typeGuard":"boolean canPreview(PaloCellInputMeta m) { return m.getFields() != null && !m.getFields().isEmpty(); }","tryCatchPattern":"try { preview(); } catch (KettleException e) { MessageBox box = new MessageBox(shell, SWT.ICON_ERROR); box.setMessage(e.getMessage()); box.open(); }","preventionTips":["Fill the fields grid before clicking Preview","Assign an output type to every field","Enable/disable the Preview button based on grid contents in the dialog UI"],"tags":["preview","validation","ui-dialog","palo"],"backgroundTag":"empty-required-field","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"}