Displaying custom error messages after running a process in PAW
Posted: Sun Dec 06, 2020 9:01 pm
Hello, ever since Planning Analtics Workspace 2.0.43 when a process execution results in errors, the error log line is displayed directly in PAW. More info about this here.
EDIT 7/3/2022: Ever since PAW 62 this is only working for ADMIN users, apparently it was a bug before. Thanks Thanks Mark for following up with this
We can use this feature to display a custom error message directly in the PAW window using the ItemReject TI function, it will reject a source record and place it in the error log with a custom error message. The syntax is something like this:
And the error will be displayed like this:
Observations:
If you use ItemReject in the Prolog section, it will skip the rest of code under it and go straight to the epilog tab.
A good approach to this if you have code in your epilog tab is to use something like this:
If you have a metadata/data section, it will skip only a single record and process the rest. So it's a good idea to place a ProcessQuit function in the metadata and data sections.
Also there's seems to be a bug (I don't know if it's fixed in the latest versions of PAW or not, I already notified IBM about it) if you have the 'Language=something' parameter in your tm1s.cfg file, it won't show the log on the error messsage in PAW, but if you remove this setting and restart the server it should work.
Thanks!
EDIT 7/3/2022: Ever since PAW 62 this is only working for ADMIN users, apparently it was a bug before. Thanks Thanks Mark for following up with this
We can use this feature to display a custom error message directly in the PAW window using the ItemReject TI function, it will reject a source record and place it in the error log with a custom error message. The syntax is something like this:
Code: Select all
If (ErrorCondition=True);
ItemReject ('Error Msg');
EndIf;
Observations:
If you use ItemReject in the Prolog section, it will skip the rest of code under it and go straight to the epilog tab.
A good approach to this if you have code in your epilog tab is to use something like this:
Code: Select all
#PROLOG
If (ErrorCondition=True);
vError=1;
ProcessBreak;
EndIf;
#EPILOG
If (vError=1);
ItemReject ('Error Msg');
EndIf;
Code: Select all
#PROLOG
If (ErrorCondition=True);
vError=1;
ItemReject ('Error Msg');
EndIf;
#METADATA and #DATA
If (vError=1);
ProcessQuit;
EndIf;
Thanks!