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.

Compute / One record

2 posts in PB Infomaker Report Writer Last posting was on 1997-12-30 14:38:26.0Z
Jim Tobin Posted on 1997-12-24 02:04:07.0Z
Newsgroups: sybase.public.infomaker.general
Date: Tue, 23 Dec 1997 21:04:07 -0500
From: Jim Tobin <jimtobin@compuserve.com>
X-Mailer: Mozilla 4.03 [en] (Win95; I)
MIME-Version: 1.0
Subject: Compute / One record
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 13
Message-ID: <348_34A06D97.20BA067D@compuserve.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.infomaker.general:7351
Article PK: 244407

I am having trouble figuring out how to insert a computed field. The
compute statement seems straight forward, but how do I identify the
column as a computed column? I have listed five fields in the order I
want them to appear. The sixth and seventh columns are to be
computed(how do I identify them)?

I also want to read a child file by a pay period date and restrict the
retrival to only one record. I want the record preceeding todays date.
And only one record.

Thanks, Jim


Terry Dykstra Posted on 1997-12-30 14:38:26.0Z
Newsgroups: sybase.public.infomaker.general
From: "Terry Dykstra" <tdykstra@cfol.ab.ca>
Subject: Re: Compute / One record
X-Newsreader: Microsoft Internet News 4.70.1161
Date: Tue, 30 Dec 1997 09:38:26 -0500
Lines: 47
Message-ID: <348_01bd109b$3d474c60$8366e4cf@tdykstra.cfol.ab.ca>
References: <348_34A06D97.20BA067D@compuserve.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.infomaker.general:7346
Article PK: 244402


Jim Tobin <jimtobin@compuserve.com> wrote in article
<34A06D97.20BA067D@compuserve.com>...
> I am having trouble figuring out how to insert a computed field. The
> compute statement seems straight forward, but how do I identify the
> column as a computed column? I have listed five fields in the order I
> want them to appear. The sixth and seventh columns are to be
> computed(how do I identify them)?
>

In your select statement you put:

select col_a, the_computed_col alias_for_the_computed_col.
from my_table

In the report you will now see alias_for_the_computed_col as a regular
computed column. You don't have to use an alias in the select statement.
In that case IM will default the name to compute_xxxx where xxxx is the
columnposition. But this is not recommended, since the name of the
computed column changes when you insert more columns in the select
statement and place them before the computed column.

You can recognize a computed field oin the report when you click on it.
The statusbar at the bottom will show 'Compute: the_name'. Regular columns
that came from the select show as 'Column: col_name'.

Be aware that a computed column in the Select statement appears as a
regular column on the report!


> I also want to read a child file by a pay period date and restrict the
> retrival to only one record. I want the record preceeding todays date.
> And only one record.
It's a tricky question, since you only want one record. Since I don't know
the structure of your tables I'll just give an example. I'm assuming that
mytable has two columns, col1 and date_col:

select * from mytable a
where date_col < today()
and date_col = ( select max(date_col)
from mytable b
where a.col1 = b.col1 )

Hope this helps.

Terry Dykstra (TeamPS)