Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Count # times a column computes certain values

4 posts in PB Infomaker Report Writer Last posting was on 1999-04-28 18:16:58.0Z
Scott Lemasters Posted on 1999-04-26 21:32:06.0Z
Newsgroups: sybase.public.infomaker.general
From: "Scott Lemasters" <georgehills2@worldnet.att.net>
Subject: Count # times a column computes certain values
Date: Mon, 26 Apr 1999 14:32:06 -0700
Lines: 26
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Message-ID: <348_ER1TdwCk#GA.326@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.infomaker.general:6403
Article PK: 241392

How do you count a column's values in IM 5.0?

Let's say I have a computed "daysafter" column for two dates. In the
Summary, I want to count the number of rows that contain certain values, for
example:

Computed column values:

1
2
2
5
1
0

Summary (This is what I want):

0-1 days late: 3
2-3 days late: 2
4 or more days late: 1

So...how would I write the expression for these three computed fields in the
Summary section? Thanks.


Rick Marden Posted on 1999-04-27 15:39:50.0Z
Newsgroups: sybase.public.infomaker.general
Reply-To: "Rick Marden" <rmarden@primavera.com>
From: "Rick Marden" <rmarden@primavera.com>
Subject: Re: Count # times a column computes certain values
Date: Tue, 27 Apr 1999 11:39:50 -0400
Lines: 47
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2014.211
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
Message-ID: <348_mW#bIPMk#GA.292@forums.sybase.com>
References: <348_ER1TdwCk#GA.326@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.infomaker.general:6401
Article PK: 241386

There may be an easier way, but I usually do this in two steps, i.e. create
a computed field in the detail that returns either a 1 if it meets the
criteria or a 0, and then sum that computed field in the summary. You can
set the visible property on your computed fields to 0 so they do not
display.
In your example I would have three computed fields in the detail:
count_a = if( your_column <= 1, 1, 0)
count_b = if( your_column >= 2 AND your_column <= 3, 1, 0)
count_c = if( your_column >= 4, 1, 0)

The summary would have sum(count_a), sum(count_b), and sum(count_c).

Rick Marden
Primavera Systems, Inc.

Scott Lemasters <georgehills2@worldnet.att.net> wrote in message
news:ER1TdwCk#GA.326@forums.sybase.com...
> How do you count a column's values in IM 5.0?
>
> Let's say I have a computed "daysafter" column for two dates. In the
> Summary, I want to count the number of rows that contain certain values,
for
> example:
>
> Computed column values:
>
> 1
> 2
> 2
> 5
> 1
> 0
>
> Summary (This is what I want):
>
> 0-1 days late: 3
> 2-3 days late: 2
> 4 or more days late: 1
>
> So...how would I write the expression for these three computed fields in
the
> Summary section? Thanks.
>
>
>


Terry Dykstra Posted on 1999-04-28 18:16:58.0Z
Newsgroups: sybase.public.infomaker.general
From: "Terry Dykstra" <tdykstra@cfol.ab.ca>
Subject: Re: Count # times a column computes certain values
Date: Wed, 28 Apr 1999 12:16:58 -0600
Lines: 59
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Message-ID: <348_cPPICLak#GA.292@forums.sybase.com>
References: <348_ER1TdwCk#GA.326@forums.sybase.com> <348_mW#bIPMk#GA.292@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.infomaker.general:6395
Article PK: 241381

Rick's method is probably the easiest. The problem is really that you are
limited to a predefined number of computed fields. If you don't know home
many computed fields you will need, you will have to go to a nested report
that does the summarizing. The downside of that is that you essentially run
the same SQL twice.

--
Terry Dykstra (TeamPS)
Canadian Forest Oil Ltd.

Rick Marden wrote in message ...
>There may be an easier way, but I usually do this in two steps, i.e. create
>a computed field in the detail that returns either a 1 if it meets the
>criteria or a 0, and then sum that computed field in the summary. You can
>set the visible property on your computed fields to 0 so they do not
>display.
>In your example I would have three computed fields in the detail:
>count_a = if( your_column <= 1, 1, 0)
>count_b = if( your_column >= 2 AND your_column <= 3, 1, 0)
>count_c = if( your_column >= 4, 1, 0)
>
>The summary would have sum(count_a), sum(count_b), and sum(count_c).
>
>Rick Marden
>Primavera Systems, Inc.
>
>Scott Lemasters <georgehills2@worldnet.att.net> wrote in message
>news:ER1TdwCk#GA.326@forums.sybase.com...
>> How do you count a column's values in IM 5.0?
>>
>> Let's say I have a computed "daysafter" column for two dates. In the
>> Summary, I want to count the number of rows that contain certain values,
>for
>> example:
>>
>> Computed column values:
>>
>> 1
>> 2
>> 2
>> 5
>> 1
>> 0
>>
>> Summary (This is what I want):
>>
>> 0-1 days late: 3
>> 2-3 days late: 2
>> 4 or more days late: 1
>>
>> So...how would I write the expression for these three computed fields in
>the
>> Summary section? Thanks.
>>
>>
>>
>
>


Scott Lemasters Posted on 1999-04-27 15:33:40.0Z
Newsgroups: sybase.public.infomaker.general
From: "Scott Lemasters" <georgehills2@worldnet.att.net>
Subject: Re: Count # times a column computes certain values
Date: Tue, 27 Apr 1999 08:33:40 -0700
Lines: 40
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Message-ID: <348_15Sd3MMk#GA.207@forums.sybase.com>
References: <348_ER1TdwCk#GA.326@forums.sybase.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.sybase.com
Xref: forums-1-dub sybase.public.infomaker.general:6402
Article PK: 241387

I've done some research, and found that I could get this total by grouping
and then entering the count calculation in the Trailer group area.

BUT, I want all the totals at the bottom of the page, and no groups. Why
isn't a simple calculation working, i.e. count (computed field = 1). I want
the summary section to count how many rows' computed fields equaled 0 to 1,
and then 2 to 3, for example. Any suggestions?

Scott Lemasters wrote in message ...
>How do you count a column's values in IM 5.0?
>
>Let's say I have a computed "daysafter" column for two dates. In the
>Summary, I want to count the number of rows that contain certain values,
for
>example:
>
>Computed column values:
>
>1
>2
>2
>5
>1
>0
>
>Summary (This is what I want):
>
>0-1 days late: 3
>2-3 days late: 2
>4 or more days late: 1
>
>So...how would I write the expression for these three computed fields in
the
>Summary section? Thanks.
>
>
>