Setting the value of a global variable from a transformation
The following code sample shows how to prompt a user for a value,
in the case the prompt is asking for a customer number, and then set
the customerNumber global variable with this
value.
Button button = new Button(this, SWT.NONE);
button.setText("Prompt for command");
button.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
InputDialog dialog = new InputDialog(getShell(), "Prompt",
"Enter a customer number:", "", null);
if (dialog.open() == InputDialog.OK) {
String value = dialog.getValue();
getSessionService().getParameterDataAccessService().
setParameterValue("hatsgv_customerNumber",value);
}
}
});
Note: The ZIETrans runtime is unaware of the new global
variable value, set by the setParameterValue() method call,
until the form is submitted.