I'd use a XML data file and a XSLT template file. xsltproc is your friend and bundled everywhere.
far easier to maintain. Check w3schools.com, they have a tutorial on XSLT. xsltproc will allow you to process XSL transformations from the command line. On Mon, Jun 15, 2009 at 1:58 PM, Peter Alcibiades < [email protected]> wrote: > We Linux users do not have access to full versions of Quartam, so have to > contain our disappointment manfully and find another way. > > Considering the question of how to get some reports done, the mind then > turns inevitably to awk. Or Perl, but for us antedeluvians, its awk. > What do you experienced Rev programmers do, because its not possible you > too turn to awk!? > > Here is the problem. I have a set of reports that come out quite nicely, > though they take several tedious pages of code. What they do is put each > total by revenue/product category/month into a field on a card. Then we > print the card, with totals. So for instance, we have handtools for Jan, > Feb....etc, and powertools for jan...feb...etc. Then a subtotal for all > tools, then a total of all the subs to get total revenue by month and YTD. > > This is done from a transaction file of several tens of thousands of > records, using filter to get the categories and months and subtotal > elements, then a simple add into a variable. Brute force, but it works > reasonably fast on a low spec machine and is accurate and easy to > understand whats been done. > > The problem comes when you want to export it into a word processor or > spreadsheet for formatting and further analysis. This is why the > antiquarian's mind turns nostalgically to awk. What awk puts out is a > somewhat formatted text file, which can just be imported into anything you > like. What we have generated in Rev is a sort of binary blob! > > Now, we could just go through and export each field from the card into a > text file. But this is going to make the whole thing even longer and more > tortuous, and you start to feel, wait a second, if this is the solution to > the problem why don't I just do it in awk in the first place and get it > over with? > > So what is the approved solution? Do you indeed go through and export your > fields? Or do you generate the report not in fields on a card but as an > rtf in one text field, and if so how? Or, he wonders smiling, are there > actually still some shamefaced users of awk out there, secretly writing > the stuff in their studies at home where none of their colleagues can see > what they are up to? > > BEGIN > {printf("%-15s\t%-40s\t%7s\t%4s\t%5s\n", "Code", "Name" , "Price", "Dept", > "Qty")} > {FS="\t"} > {OFS="\t"} > {printf("%-15s\t%-40s\t%7s\t%4s\t%5s\n",$1, $2, $3, $4, $5)} > > and so on. Ah the sweet smell of cordite in the morning! > > Peter > _______________________________________________ > use-revolution mailing list > [email protected] > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-revolution > -- http://www.andregarzia.com All We Do Is Code. _______________________________________________ use-revolution mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
