Template print to PDF, opening PDF file shows 'invalid token' or similar error
Hint Ref: 020911270001
Hint Date: 27/11/2009
When exporting a template to a PDF file, when opening this file an error from Adobe Reader will show an error about 'An Error exists on this page...' or 'invalid token' (depending on which version of Adobe Reader is being used).
Within the SQL for the template, there may be a statement that will be looking for the min/max of a date with a chance that the result will be null. Adobe Reader doesn't like this. Even using 'isnull()' and having a guaranteed result in the 2nd parameter doesn't solve the issue when that initial min/max is still there. One way to work around this is to avoid the min/max from ever returning null at any point. For example, with the iqacdocument and accountlink tables:
isnull(max(datefrom),accountingdate) - here the max(datefrom) may return null, so the statement can be changed to something like:
if (select first datefrom where datefrom is not null) is null then accountingdate else max(datefrom) endif - the max() here will never have a chance to return null with this statement.
(Please Note: This Procedure can be destructive and should only be used by Advanced Users. RADical Systems (UK) Limited or its Partners cannot be held responsible, in anyway, for any consequence of using this or any other Database Function, Procedure or SQL command. Responsibility resides solely with the user.
IT IS HIGHLY RECOMMENDED THAT A FULL AND VALID SPACE MANAGER DATABASE BACKUP IS TAKEN AND VERIFIED AS VALID BEFORE MAKING ANY CHANGES TO THE DATABASE.)