Planning Analytics TurboIntegrator processes allow us to set up parameter to control data processing #
Planning Analytics Workspace has a handy interface to help you build TurboIntegrator processes.
However, you can also create and run a process manually. This could result in human error, so it is possible to have Planning Analytics sense check your work. For example, in a process, you might want to make sure that:
- The entered start and end dates are valid elements.
- The start date is in the future.
- The end date is later than the start date.
You would only want to proceed when the parameters meet all criteria. Otherwise, you need to bail out and send the user an error message.
The first thing to do in the PROLOG section is a sanity check on the entered parameters. Set an internal error checking flag so that whenever a parameter fails a test, it throws the error switch and creates a meaningful error message for the end-user. Bear in mind that there might be multiple errors in the entered parameters, and you will want to feed the user as much information as possible.
After all your parameter checks, if there are any problems, issue a ‘PROCESSBREAK’ command which forces the processing to stop immediately and go to the EPILOG section. The first thing to do in the EPILOG section is to check whether there was an error in the parameters and if there is reject the item that forces a break in processing and will display to the user the entire error message constructed in the PROLOG section.
TI Process Code #
#Section Prolog # Check all the entered parameters # If there is an error in the parameter # Write the error to the error log file for the process # Break the process which forces the processing to the EPILOG # In the EPILOG section check the error flag # If the entered parameters are not OK # Reject the item vEnteredParameters = 'All OK'; sDimensionFilter = 'T__Date'; # Is the start date a valid element? # If the element is a member of the dimension specified, the function returns a number > 0. IF (DIMIX(sDimensionFilter, pStartDate) > 0); vValidStartDate = ''; ELSE; vValidStartDate = '[Invalid Start Date ' | pStartDate | ']'; vEnteredParameters = 'Not OK'; ENDIF; # Is the end date a valid element? # If the element is a member of the dimension specified, the function returns a number > 0. IF (DIMIX(sDimensionFilter, pEndDate) > 0); vValidEndDate = ''; ELSE; vValidEndDate = '[Invalid End Date ' | pEndDate | ']'; vEnteredParameters = 'Not OK'; ENDIF; # IF the Start and End dates are valid elements # Is the Start Date in the future (i.e. > Today)? # T__Date element is held in YYYYMMDD format so must be converted to 'YYYY-MM-DD' string IF (vEnteredParameters @= 'All OK' ); IF (TODAY(1) @< SUBST(pStartDate,1,4) | '-' | SUBST(pStartDate,5,2) | '-' | SUBST(pStartDate,7,2)); vValidStartInFuture = ''; ELSE; vValidStartInFuture = '[Start Date ' | pStartDate | ' is not in the future]'; vEnteredParameters = 'Not OK'; ENDIF; ENDIF; # IF the Start and End dates are valid elements and the start date is in the future # Is the end date later than the start date? IF (vEnteredParameters @= 'All OK'); IF (pEndDate @> pStartdate); vValidDateRange = ''; ELSE; vValidDateRange = '[' | pStartDate | ' & ' | pEndDate | ' is not a valid range]'; vEnteredParameters = 'Not OK'; ENDIF; ENDIF; # Check for errors in the parameters # If there are errors create an error message and force processing to go to the EPILOG section # and there force the error message IF (vEnteredParameters @= 'Not OK'); vErrorMessage = vValidStartDate | vValidEndDate | vValidStartInFuture | vValidDateRange; PROCESSBREAK; ENDIF; ========================================================================= #Section Epilog #****Begin: Generated Statements*** #****End: Generated Statements**** # Check if the entered parameters were OK # If there was a problem with the entered parameters # force the error message IF (vEnteredParameters @= 'Not OK'); ITEMREJECT (vErrorMessage); ENDIF;
Once this has run, the User should get a notice with a message similar to this: