I am occupied these days by ensuring that all the procedures that I wrote for the Windows client also work with the Web interface. Yesterday I had an interesting example of this: a procedure accepts an external file, creates a customer order from the data in the file then sends a confirmatory email in the form of a report. Almost everything executed correctly, but the email was not being sent.
Looking at the 25.1 SDK, the following appears:
You can execute a procedure from an SQLI step of another procedure by executing any of the following commands: WINACTIV, ACTIVATE or ACTIVATF. This is useful, for example, when you want to run a report and send it to recipients via e-mail. Reports can be executed using the WINACTIV command only. ... (half a page later) As noted above, reports can only be run by WINACTIV, which should not be used in the Web interface.
SELECT SQL.TMPFILE INTO :FILESIZE FROM DUMMY; LINK STACK TO :FILESIZE; ERRMSG 10 WHERE :RETVAL <= 0; :TMPFILE = ''; SELECT STRCAT(SQL.TMPFILE, '.html') INTO :TMPFILE FROM DUMMY; EXECUTE ACTIVATF '-R', '[reportname]', '-o', :TMPFILE; EXECUTE GETSIZE :TMPFILE, :FILESIZE; GOTO 2703 WHERE NOT EXISTS ( SELECT 'X' FROM STACK WHERE ELEMENT > 0); MAILMSG 12 TO GROUP '[groupname]' DATA :TMPFILE; LABEL 2703;
So much for the statement the 'Reports can be executed using the WINACTIV command only'. Here we have an example of ACTIVATF running the report. At the moment, I can't unconditionally report that this works: I tried this on my home computer, connected via VPN but not running RDP, whilst running Outlook. A letter was created with the required file and sent, but I didn't receive it at my work address.
When I tried it yesterday on the work server, I initially got the error that I was trying to perform an action that requires the web plugin. The plugin existed but it wasn't turned on. When I tried again this morning, nothing was sent. Running the procedure with the debugger, I saw that the 'mailmsg' was jumped over. From this, I understand that the problem probably is as follows: any report to be run must not have any parameters for input. I had written the report so as to overcome this minor problem, but it only reports data for 'today', and today there is no appropriate data (although there was yesterday).
No comments:
Post a Comment