Tuesday, March 03, 2020

Sending a report via email in English (Priority)

I was asked to create a report which shows all the purchase order lines for which we have not yet received confirmation from the vendor. This is not much of a problem, but once my clients saw the report, they wanted to send a copy to each vendor, where of course each vendor sees only their orders.

Following on from my successful 'all in one HTML report', I suggested doing something similar: creating a letter with a few lines of explaining what the attached report was and then attaching the report, which is now in the form of an HTML document. Although this wasn't particularly straight-forward (the main problem was writing a query which would loop through all the vendors in order to find to whom the letter should be sent), it wasn't too difficult.

Then the problems began. "The HTML report should be in English", I was told. OK; I started researching how certain HTML documents in the system 'know' to print themselves in English. It took me several passes over such a document before I noticed that there was a flag in the procedure definition which had a different value to what I've always used; the 'HTML document' flag was marked E and not Y. Once I saw this, I was able to get the report to print itself in English.

Full of confidence, I then scheduled the report so that the letters would be sent to my client (as opposed to the vendors). He returned the letters to me saying that they should be in English. Huh, I wondered? How is it possible that that the document displays left to right when I create it manually but right to left when it is created programmatically?

I decided to read the (almost incomprehensible) documentation again (shown below) and discovered that I need to add a flag to the command which creates the document; this flag overrides the E flag within the procedure. RTFM. Even the 'E' flag in the procedure is documented. Now everything works correctly, although I'm sure that the client will find something else to be changed.


No comments: