dbTalk Databases Forums  

case date

comp.databases.filemaker comp.databases.filemaker


Discuss case date in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
marmot
 
Posts: n/a

Default case date - 11-04-2006 , 12:32 PM






i've scouted around and haven't found the answer to this probably dumb
question

since it is probably a synch to cure, here goes:

i've got a table with some fields, including 'date' and 'tax year'

I'd like it if 'tax year' returned 05-06 or 06-07 etc depending on
where the contents of 'date' lie in a date range

so I've set up 'tax year' as a calculation field returning text

case("1/4/05=<date=<31/3/06"; "05-06";"1/4/06=<date=<31/3/07"; "06-07")

it's causing me much puzzlement that this doesn't seem to work.
whatever the value 'date' holds, 'tax year' returns 05-06.

something's wrong, but i can't fathom

any thoughts...

marmot


Reply With Quote
  #2  
Old   
Howard Schlossberg
 
Posts: n/a

Default Re: case date - 11-04-2006 , 01:14 PM






You can't combine two tests into one. Try breaking out your calc as this:

case(
DateField >= date(4; 1; 2005) and DateField <= date(3; 31; 2006); "05-06";
DateField >= date(4; 1; 2006) and DateField <= date(3; 31; 2007); "06-07" )

Or better yet, why not make it dynamic so that you don't have to change
the calc each year:

case(
month(DateField) >= 4; right(year(DateField), 2) & "-" &
right(year(DateField)+1; 2);
right(year(DateField)-1, 2) & "-" & right(year(DateField); 2) )



marmot wrote:
Quote:
i've scouted around and haven't found the answer to this probably dumb
question

since it is probably a synch to cure, here goes:

i've got a table with some fields, including 'date' and 'tax year'

I'd like it if 'tax year' returned 05-06 or 06-07 etc depending on
where the contents of 'date' lie in a date range

so I've set up 'tax year' as a calculation field returning text

case("1/4/05=<date=<31/3/06"; "05-06";"1/4/06=<date=<31/3/07"; "06-07")

it's causing me much puzzlement that this doesn't seem to work.
whatever the value 'date' holds, 'tax year' returns 05-06.

something's wrong, but i can't fathom

any thoughts...

marmot

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Professional Solutions, Inc. Los Angeles

FileMaker 8 Certified Developer
Associate Member, FileMaker Solutions Alliance


Reply With Quote
  #3  
Old   
marmot
 
Posts: n/a

Default Re: case date - 11-04-2006 , 01:29 PM



hi

it works!

new to me is the need (apparently) to write the date parameter using
the date function i.e date(month;day;year) instead of as a date in the
format specified in layout..

and I did not know about combining tests not working.

thanks again

marmot

Howard Schlossberg wrote:
Quote:
You can't combine two tests into one. Try breaking out your calc as this:

case(
DateField >= date(4; 1; 2005) and DateField <= date(3; 31; 2006); "05-06";
DateField >= date(4; 1; 2006) and DateField <= date(3; 31; 2007); "06-07" )

Or better yet, why not make it dynamic so that you don't have to change
the calc each year:

case(
month(DateField) >= 4; right(year(DateField), 2) & "-" &
right(year(DateField)+1; 2);
right(year(DateField)-1, 2) & "-" & right(year(DateField); 2) )



marmot wrote:
i've scouted around and haven't found the answer to this probably dumb
question

since it is probably a synch to cure, here goes:

i've got a table with some fields, including 'date' and 'tax year'

I'd like it if 'tax year' returned 05-06 or 06-07 etc depending on
where the contents of 'date' lie in a date range

so I've set up 'tax year' as a calculation field returning text

case("1/4/05=<date=<31/3/06"; "05-06";"1/4/06=<date=<31/3/07"; "06-07")

it's causing me much puzzlement that this doesn't seem to work.
whatever the value 'date' holds, 'tax year' returns 05-06.

something's wrong, but i can't fathom

any thoughts...

marmot


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Howard Schlossberg (818) 883-2846
FM Professional Solutions, Inc. Los Angeles

FileMaker 8 Certified Developer
Associate Member, FileMaker Solutions Alliance


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.