[ic] Complex Order Reports

Doug Alcorn doug@lathi.net
15 Jan 2001 23:46:16 -0500


"Lee Hoffman" <lee@rsub.net> writes:

> Is there any SQL expert out there that knows off the top of their
> head how to run queries to extract the above data from the
> transactions database?

Lately I've been partial to:

[query st=db arrayref=returnarray
        sql="select col1, col2, col3 from table where
col1=condition"][/query]
[perl]
  my $returnarray = $Tmp->{returnarray};

  return "No rows" unless ($returnaray && scalar @$returnarray > 0);

  foreach my $row (@$returnarray) {
    my $col1 = $$row[0];
    my $col2 = $$row[1];
    my $col3 = $$row[2];

    my $return = compute($col1, $col2, $col3);
  }

  return $return;
[/perl]

Sometimes instead of [perl][/perl] tags I like [mvasp][/mvasp] tags
depending on how much formatted HTML I want intermixed with the perl
code.  For custom reports, maybe [mvasp] is better.

Also, it may be possible to do all this easier with the UI.  I haven't
learned to become one with the UI.  In my un-Enlightened state, I just
use vi to write my pages from scratch.
-- 
 (__) Doug Alcorn (mailto:doug@lathi.net http://www.lathi.net)
 oo / PGP 02B3 1E26 BCF2 9AAF 93F1  61D7 450C B264 3E63 D543
 |_/  If you're a capitalist and you have the best goods and they're
      free, you don't have to proselytize, you just have to wait.