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.

Need Help Using Date in an If statement

3 posts in PB Infomaker Report Writer Last posting was on 1998-12-17 10:18:34.0Z
Tom Walker Posted on 1998-12-16 14:42:46.0Z
Newsgroups: sybase.public.infomaker.general
Date: Wed, 16 Dec 1998 14:42:46 +0000
From: Tom Walker <twalker@aston-zoraster.co.uk>
X-Mailer: Mozilla 4.5 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Need Help Using Date in an If statement
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 14
Message-ID: <348_3677C6E5.8F00A22@aston-zoraster.co.uk>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.infomaker.general:6661
Article PK: 241648

I'm trying to design a report which picks up the previous month's
transactions. To get a report run in January to pick up December
entries I've put an entry in the Where tab like this:
"database.datefield" = if(month(now())=1, 12, month(now())-1 )

I keep getting a syntax error indicating the comma after the 12 in the
square brackets.

The if expression works OK (using today() rather than now()) in the
report painter but I can't get it to accept either version in the Where
tab.

Thanks for any suggestions.


Terry Dykstra Posted on 1998-12-16 15:57:34.0Z
Newsgroups: sybase.public.infomaker.general
From: "Terry Dykstra" <tdykstra@cfol.ab.ca>
Subject: Re: Need Help Using Date in an If statement
Date: Wed, 16 Dec 1998 08:57:34 -0700
Lines: 25
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Message-ID: <348_y7PlIwQK#GA.212@forums.powersoft.com>
References: <348_3677C6E5.8F00A22@aston-zoraster.co.uk>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.infomaker.general:6659
Article PK: 241645

The Where clause in the SQL painter is DBMS specific. Remember, at that
point you are writing SQL SELECT statements. So you have to check your DBMS
to see what fucntions are allowed. For instance, Oracle doesn't support an
IF statement.

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

Tom Walker wrote in message <3677C6E5.8F00A22@aston-zoraster.co.uk>...
>I'm trying to design a report which picks up the previous month's
>transactions. To get a report run in January to pick up December
>entries I've put an entry in the Where tab like this:
>"database.datefield" = if(month(now())=1, 12, month(now())-1 )
>
>I keep getting a syntax error indicating the comma after the 12 in the
>square brackets.
>
>The if expression works OK (using today() rather than now()) in the
>report painter but I can't get it to accept either version in the Where
>tab.
>
>Thanks for any suggestions.
>


Tom Walker Posted on 1998-12-17 10:18:34.0Z
Newsgroups: sybase.public.infomaker.general
Date: Thu, 17 Dec 1998 10:18:34 +0000
From: Tom Walker <twalker@aston-zoraster.co.uk>
X-Mailer: Mozilla 4.5 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
Subject: Re: Need Help Using Date in an If statement
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 28
Message-ID: <348_3678DA79.92ACDB5D@aston-zoraster.co.uk>
References: <348_3677C6E5.8F00A22@aston-zoraster.co.uk> <348_y7PlIwQK#GA.212@forums.powersoft.com>
Path: forums-1-dub!forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.infomaker.general:6658
Article PK: 241644

Many thanks - its SQL Anywhere and IF.....THEN.....ELSE......ENDIF seems to work
fine.

Terry Dykstra wrote:

> The Where clause in the SQL painter is DBMS specific. Remember, at that
> point you are writing SQL SELECT statements. So you have to check your DBMS
> to see what fucntions are allowed. For instance, Oracle doesn't support an
> IF statement.
>
> --
> Terry Dykstra (TeamPS)
> Canadian Forest Oil Ltd.
> Tom Walker wrote in message <3677C6E5.8F00A22@aston-zoraster.co.uk>...
> >I'm trying to design a report which picks up the previous month's
> >transactions. To get a report run in January to pick up December
> >entries I've put an entry in the Where tab like this:
> >"database.datefield" = if(month(now())=1, 12, month(now())-1 )
> >
> >I keep getting a syntax error indicating the comma after the 12 in the
> >square brackets.
> >
> >The if expression works OK (using today() rather than now()) in the
> >report painter but I can't get it to accept either version in the Where
> >tab.
> >
> >Thanks for any suggestions.
> >