Sort fields getting the best of me...
Michael Mantkowski
michaelj at clientrax.com
Sun Jan 3 08:31:51 EST 2010
Hi Bas,
I am not positive of this, but I believe that since you are using
$printrecord in a loop, that you must sort your list in the same order as
the sort fields of your report.
If you set the Reports Main List to your list and then use Print Report,
then I think this is done automatically.
It has been a lot of years since I looked into the whys and wherefores of
this and it's just how I do things now. But it seems to me that is the way
it is.
I still always use the 4GL commands for sorting my lists and printing
reports. They are just so much easier to read.
Something like this.
Begin reversible block
Set current list to ivDataList
End reversible block
Clear sort fields
Set sort field ClientNo (Subtotal)
Set sort field InvoiceNo (Subtotal)
Set sort field InvoiceDetailNo
Sort List
For each line in list
Print record
End for
Michael
*********************************************************************
Michael Mantkowski
ClienTrax Software
1-800-416-2815
*********************************************************************
-----Original Message-----
From: omnisdev-en-bounces at lists.omnis-dev.com
[mailto:omnisdev-en-bounces at lists.omnis-dev.com] On Behalf Of Bastiaan Olij
Sent: Sunday, January 03, 2010 5:12 AM
To: OmnisList
Subject: Sort fields getting the best of me...
Hey all,
Hoping someone can shed some light on the subject here. I've got a list
with data that I fetched from my database and I'm trying to print the
contents of this list and use subtotalling. The list basically contains
records from three tables. Lets say for arguments sake these tables are
client, invoice, detail (they are not but its an easy example). Any
client can have 1 or more invoices, any invoice can have 1 or more
detail lines. All columns are dynamically added to the list and not
bound to anything in the CRB.
In my particular case I have a method within my report as follows
(ivDataList is an instance variable of my report and contains the data) :
--
For ivDataList.$line from 1 to ivDataList.$linecount step1
do $cinst.$printrecord()
End For
--
I have not set the $mainlist property of the report (I haven't really
looked into this yet, it may be just what I'm overlooking).
My subtotal 1 sections will print some client info, my subtotal 2
section prints my invoice info and the record is my detail. The list is
already properly sorted and as I can have different client records with
the same name and since I'm sorting my invoice list on date I can't
garantee uniquness on that field I want to trigger my subtotalling on
the record ID of these records.
First question right there, seeing we are using sort fields to get this
to work, does that mean my data suddenly gets sorted on records IDs? So
far it seems to ignore this as far as sorting is concerned. If I add the
fields I am sorting on but without setting "subtotaling" to true, it
still seems to make these fields part of the subtotalling throwing
things off completely.
Second question, for some weird reason I can not get things to work
properly unless I set the sort fields in my report configuration and at
the same time using the old 4GL commands to set the sort fields.. It is
as if somehow it requires the configuration of the report to be set in
order to work, but it is not loading this into the sort fields buffer.
The only thing I can imagine is that everything is based on the contents
of a list and when the report gets constructed, this list has not been
assigned its contents yet.
I've got it working but I'm really starting to get a bit uncertain how
this stuff is supposed to work.
P.S. final bit that may be throwing things off, all the code and my
ivMainList variable is in a report base class while the specifics of
this report is in a subclass.
Cheers,
Bastiaan Olij
_____________________________________________________________
Manage your list subscriptions at http://lists.omnis-dev.com
More information about the omnisdev-en
mailing list