I wrote1 several months ago about the tedious process of adding English
titles to reports and forms. That kind of work has settled down, but instead
I've had to face some rather strange problems. The latest example is a
report that is sent by email via TTS; the data is prepared by a procedure
that sends the report with the EXECUTE WINACTIV command. The problem, as one
might guess, is that when it is sent based on Indian data, the report is in
Hebrew.
The immediate problem about the body of the report was fixed quite easily as
the form for a TTS task has a 'language' field. When this was set to
English, the body of the report was indeed sent in English (and left
to right) but the title of the report stayed in Hebrew, despite my
having defined a translation of the report title. When the report is run
from the menu by a user, this English title appears.
I thought at first that there might be an undocumented flag for WINACTIV
that would force an English environment; notionally such a flag would be -e,
but this character is already used to signify that the report should be sent
to an email address. I tried saving the output to a file (then send it on
via MAILMSG) to see whether this would make any difference, but it didn't.
There is no possibility of assigning a value to SQL.LANGUAGE; in comparison
SQL.ENV holds the name of the current environment that can be changed by
invoking the ENV function.
I'm not sure where the inspiration for my solution came from, but it
occurred to me that all I needed to do was to update the title of the
report in the EXEC table. So I added the following code towards the end
of the procedure, after the data has been collected but before the report is
sent.
GOTO 10 WHERE SQL.COUNTRY = 'ISR'; /* India */ :MSGNUM = 10; :GROUP = 'INDIAGROUP'; GOTO 20; LABEL 10; /* Israel */ :MSGNUM = 20; :GROUP = 'ISRAELGROUP'; LABEL 20; GOSUB 900; EXECUTE WINACTIV '$', SQL.TMPFILE, 'STACK', :$.STK, '-g', :GROUP; GOTO 99 WHERE :MSGNUM = 20; :MSGNUM = 20; GOSUB 900; LABEL 99; /* End */ /***********************************************/ SUB 900; SELECT ENTMESSAGE ('$', 'P', :MSGNUM) INTO :PAR1 FROM DUMMY; UPDATE EXEC SET TITLE = :PAR1 WHERE ENAME = '$' AND TYPE = 'R'; RETURN
Message 10 holds the English title whereas message 20 holds the Hebrew title. There's no point in resetting the title after the report has been created if it has already been set to Hebrew. This hack only works because the report is being sent by a spawned process; if it were run from the menu, the report is effectively already loaded into memory when the procedure starts and so run-time changes do not take effect (unless one is using the documented methods which aren't applicable here).
Internal links
[1] 119