Creating the onInputOrParameterChange Method
Once you define the parameters the user can customize, you must define the behavior of the operator when the user adjusts those parameters.
In our operator in particular, we must be able to update the schema if the user chooses a different number of rows to output, or a different format. To do that, we override the function
onInputOrParameterChange. This method updates the schema and then returns the operator's status (valid or invalid). Because runtime errors occur if the parameters have no values, we say that the operator status is always valid.
Procedure
-
Add the following code:
override def onInputOrParameterChange( inputSchemas: Map[String, TabularSchema], params: OperatorParameters, operatorSchemaManager: OperatorSchemaManager): OperatorStatus = { // update the schema // this is using the value chosen by the user in the Alpine GUI operatorSchemaManager.setOutputSchema(DatasetGeneratorUtils.getOutputSchema(params)) // return the operator status with isValid = true. OperatorStatus(isValid = true) }
Copyright © 2021. Cloud Software Group, Inc. All Rights Reserved.