Featured Post

Applying Email Validation to a JavaFX TextField Using Binding

This example uses the same controller as in a previous post but adds a use case to support email validation.  A Commons Validator object is ...

Saturday, May 21, 2011

Protecting Yourself in Talend Open Studio

Every once and a while, I run the wrong job in Talend Open Studio.  tMsgBox can prevent any damage by requiring a confirmation before proceeding.

When working with several jobs, sometimes the toolbar Run button (green circle with an arrow) doesn't reflect the currently displayed job.  This can lead to an accidental running of a job which is problematic if the job deletes files or changes data.

tMsgBox is a component that will display a dialog box that can gather a confirmation from a user before proceeding.  The following screenshot shows a tMsgBox confirming a delete operation before proceeding.

tMsgBox Prompting Confirmation of a Deletion

The tMsgBox uses the Run If trigger to invoke the delete operations if the user selects "Yes".  To use the Run If,
  1. Right-click on the tMsgBox
  2. Select Trigger > Run If
  3. Connect to the following subjob.
  4. Select the If connector
  5. Enter a condition like the following
((String)globalMap.get("tMsgBox_1_RESULT")).equals("0")

"0" indicates a success or "Yes" value; "1" indicates a "No".  There is no explicit handling of a No, the job stops.

Other possible comparisons are listed below.  Return values are based on the Buttons select in the tMsgBox Component View.
  • YES_OPTION  = 0
  • NO_OPTION  = 1
  • CANCEL_OPTION = 2
  • OK_OPTION  = 0
  • CLOSED_OPTION = -1
The tMsgBox is useful in development to prevent the accidental run of a job that may delete files of modify data.  For a production job where you're not as concerned with a beforehand check, be sure to remove the tMsgBox because it will be displayed outside of TOS in the exported job.

No comments:

Post a Comment