Sorting for sub-summary report

Sorting for sub-summary report

am 31.01.2008 13:13:28 von carla

I have a report with 3 sub-summaries, with "Yes/No" fields set by the
user to determine whether the sub-summaries are required or not. The
user can select any combination of the 3.

I'm now trying to write the script to produce the report, and can't
work out how best to specify the sort order required within the
script.

What I *want* to do is this:

If SubSummary1 is required, sort the records using FieldA.
If SubSummary2 is required, sort the records using FieldB (AND FieldA
if required)
If SubSummary3 is required, sort the records using FieldC (AND FieldA
if required, and FieldB if required)

... but obviously this doesn't work, because if a sort order has been
established in the first "If", it's overridden by the next sort.

I can see how to do it using a tedious series of nested "Ifs", but
feel there must be a more elegant way. (Plus I'll probably end up
with more than 3 sub-summaries, so the whole nested If thing could get
rather unwieldy!)

Any suggestions much appreciated.

Carla.

Re: Sorting for sub-summary report

am 31.01.2008 14:52:37 von bill

In article
<18ea64dd-444c-4317-9123-7fc37691247a@n20g2000hsh.googlegroups.com>,
Carla wrote:

> I have a report with 3 sub-summaries, with "Yes/No" fields set by the
> user to determine whether the sub-summaries are required or not. The
> user can select any combination of the 3.
>
> I'm now trying to write the script to produce the report, and can't
> work out how best to specify the sort order required within the
> script.
>
> What I *want* to do is this:
>
> If SubSummary1 is required, sort the records using FieldA.
> If SubSummary2 is required, sort the records using FieldB (AND FieldA
> if required)
> If SubSummary3 is required, sort the records using FieldC (AND FieldA
> if required, and FieldB if required)
>
> .. but obviously this doesn't work, because if a sort order has been
> established in the first "If", it's overridden by the next sort.
>
> I can see how to do it using a tedious series of nested "Ifs", but
> feel there must be a more elegant way. (Plus I'll probably end up
> with more than 3 sub-summaries, so the whole nested If thing could get
> rather unwieldy!)
>
> Any suggestions much appreciated.
>
> Carla.

You can put all three fields in the same sort, without any "if" or
"case" conditions. Of course one has to be first, another second and the
last third in the sort order, but it will sort by all three. So the
subsummaries should all work.

--
Bill Collins
For email, change "fake" to "earthlink"

Re: Sorting for sub-summary report

am 31.01.2008 15:16:45 von carla

On Jan 31, 1:52=A0pm, Bill wrote:
> In article
> <18ea64dd-444c-4317-9123-7fc376912...@n20g2000hsh.googlegroups.com>,
>
>
>
>
>
> =A0Carla wrote:
> > I have a report with 3 sub-summaries, with "Yes/No" fields set by the
> > user to determine whether the sub-summaries are required or not. =A0The
> > user can select any combination of the 3.
>
> > I'm now trying to write the script to produce the report, and can't
> > work out how best to specify the sort order required within the
> > script.
>
> > What I *want* to do is this:
>
> > If SubSummary1 is required, sort the records using FieldA.
> > If SubSummary2 is required, sort the records using FieldB (AND FieldA
> > if required)
> > If SubSummary3 is required, sort the records using FieldC (AND FieldA
> > if required, and FieldB if required)
>
> > .. but obviously this doesn't work, because if a sort order has been
> > established in the first "If", it's overridden by the next sort.
>
> > I can see how to do it using a tedious series of nested "Ifs", but
> > feel there must be a more elegant way. =A0(Plus I'll probably end up
> > with more than 3 sub-summaries, so the whole nested If thing could get
> > rather unwieldy!)
>
> > Any suggestions much appreciated.
>
> > Carla.
>
> You can put all three fields in the same sort, without any "if" or
> "case" conditions. Of course one has to be first, another second and the
> last third in the sort order, but it will sort by all three. So the
> subsummaries should all work.
>
> --
> Bill Collins
> For email, change "fake" to "earthlink"- Hide quoted text -
>
> - Show quoted text -

Thanks Bill, but the problem is that the user may not *want* ALL the
subsummaries to work. So I need a way of doing the sort using any 1,
any 2, or all 3 of the sort fields, according to what subsummaries the
user has requested. (Sorry if I didn't make that clear.)

Carla.

Re: Sorting for sub-summary report

am 31.01.2008 15:30:58 von Grip

On Jan 31, 5:13 am, Carla wrote:
> I have a report with 3 sub-summaries, with "Yes/No" fields set by the
> user to determine whether the sub-summaries are required or not. The
> user can select any combination of the 3.
>
> I'm now trying to write the script to produce the report, and can't
> work out how best to specify the sort order required within the
> script.
>
> What I *want* to do is this:
>
> If SubSummary1 is required, sort the records using FieldA.
> If SubSummary2 is required, sort the records using FieldB (AND FieldA
> if required)
> If SubSummary3 is required, sort the records using FieldC (AND FieldA
> if required, and FieldB if required)
>
> .. but obviously this doesn't work, because if a sort order has been
> established in the first "If", it's overridden by the next sort.
>
> I can see how to do it using a tedious series of nested "Ifs", but
> feel there must be a more elegant way. (Plus I'll probably end up
> with more than 3 sub-summaries, so the whole nested If thing could get
> rather unwieldy!)
>
> Any suggestions much appreciated.
>
> Carla.

If[C]
Sort by A,B,C
Else If[B]
Sort by A,B
Else If[A]
Sort by A
End If

Re: Sorting for sub-summary report

am 31.01.2008 16:24:13 von carla

On Jan 31, 2:30=A0pm, Grip wrote:
> On Jan 31, 5:13 am, Carla wrote:
>
>
>
>
>
> > I have a report with 3 sub-summaries, with "Yes/No" fields set by the
> > user to determine whether the sub-summaries are required or not. =A0The
> > user can select any combination of the 3.
>
> > I'm now trying to write the script to produce the report, and can't
> > work out how best to specify the sort order required within the
> > script.
>
> > What I *want* to do is this:
>
> > If SubSummary1 is required, sort the records using FieldA.
> > If SubSummary2 is required, sort the records using FieldB (AND FieldA
> > if required)
> > If SubSummary3 is required, sort the records using FieldC (AND FieldA
> > if required, and FieldB if required)
>
> > .. but obviously this doesn't work, because if a sort order has been
> > established in the first "If", it's overridden by the next sort.
>
> > I can see how to do it using a tedious series of nested "Ifs", but
> > feel there must be a more elegant way. =A0(Plus I'll probably end up
> > with more than 3 sub-summaries, so the whole nested If thing could get
> > rather unwieldy!)
>
> > Any suggestions much appreciated.
>
> > Carla.
>
> If[C]
> Sort by A,B,C
> Else If[B]
> Sort by A,B
> Else If[A]
> Sort by A
> End If- Hide quoted text -
>
> - Show quoted text -

Sorry, I've not been clear. ANY combination of A, B and C is
possible, i.e. any 1 field, any combination of 2 (i.e. AB, AC, BC), or
all 3. So 7 permutations with the current setup, but many more if I
add further subsummary options, as I plan to.

C.

Re: Sorting for sub-summary report

am 31.01.2008 16:41:34 von bill

In article
,
Carla wrote:

> On Jan 31, 1:52 pm, Bill wrote:
> > In article
> > <18ea64dd-444c-4317-9123-7fc376912...@n20g2000hsh.googlegroups.com>,
> >
> >
> >
> >
> >
> >  Carla wrote:
> > > I have a report with 3 sub-summaries, with "Yes/No" fields set by the
> > > user to determine whether the sub-summaries are required or not.  The
> > > user can select any combination of the 3.
> >
> > > I'm now trying to write the script to produce the report, and can't
> > > work out how best to specify the sort order required within the
> > > script.
> >
> > > What I *want* to do is this:
> >
> > > If SubSummary1 is required, sort the records using FieldA.
> > > If SubSummary2 is required, sort the records using FieldB (AND FieldA
> > > if required)
> > > If SubSummary3 is required, sort the records using FieldC (AND FieldA
> > > if required, and FieldB if required)
> >
> > > .. but obviously this doesn't work, because if a sort order has been
> > > established in the first "If", it's overridden by the next sort.
> >
> > > I can see how to do it using a tedious series of nested "Ifs", but
> > > feel there must be a more elegant way.  (Plus I'll probably end up
> > > with more than 3 sub-summaries, so the whole nested If thing could get
> > > rather unwieldy!)
> >
> > > Any suggestions much appreciated.
> >
> > > Carla.
> >
> > You can put all three fields in the same sort, without any "if" or
> > "case" conditions. Of course one has to be first, another second and the
> > last third in the sort order, but it will sort by all three. So the
> > subsummaries should all work.
> >
> > --
> > Bill Collins
> > For email, change "fake" to "earthlink"- Hide quoted text -
> >
> > - Show quoted text -
>
> Thanks Bill, but the problem is that the user may not *want* ALL the
> subsummaries to work. So I need a way of doing the sort using any 1,
> any 2, or all 3 of the sort fields, according to what subsummaries the
> user has requested. (Sorry if I didn't make that clear.)
>
> Carla.

The user can simply ignore the subsummaries they don't care about.

Another way is to make three different layouts, with each of the
subsummaries in one of the layouts. Then make the script so that it
sorts by the desired choice and then goes to the desired layout to
display the result.

--
Bill Collins
For email, change "fake" to "earthlink"

Re: Sorting for sub-summary report

am 01.02.2008 10:11:57 von carla

On Jan 31, 12:13=A0pm, Carla wrote:
> I have a report with 3 sub-summaries, with "Yes/No" fields set by the
> user to determine whether the sub-summaries are required or not. =A0The
> user can select any combination of the 3.
>
> I'm now trying to write the script to produce the report, and can't
> work out how best to specify the sort order required within the
> script.
>
> What I *want* to do is this:
>
> If SubSummary1 is required, sort the records using FieldA.
> If SubSummary2 is required, sort the records using FieldB (AND FieldA
> if required)
> If SubSummary3 is required, sort the records using FieldC (AND FieldA
> if required, and FieldB if required)
>
> .. but obviously this doesn't work, because if a sort order has been
> established in the first "If", it's overridden by the next sort.
>
> I can see how to do it using a tedious series of nested "Ifs", but
> feel there must be a more elegant way. =A0(Plus I'll probably end up
> with more than 3 sub-summaries, so the whole nested If thing could get
> rather unwieldy!)
>
> Any suggestions much appreciated.
>
> Carla.

Thanks for your suggestions.

C.