dbTalk Databases Forums  

Dates and Calculation fields

comp.databases.filemaker comp.databases.filemaker


Discuss Dates and Calculation fields in the comp.databases.filemaker forum.



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

Default Dates and Calculation fields - 12-14-2005 , 02:10 AM






I am trying to get a calculation field to work by adding so many
years from a date and another calculation field. I'm using FMP 5.5 on
a Windows XP machine. More details are below.
The first field is a text for what the equipment is in a pop up list
and the 2nd field is calculation using the case function. This way if
I select "red" in the pop up list, the calculation will display a 5 but
if I choose "green" then a 10 will be shown. This is for the number of
years in the future when the next maintence is due.
The 3rd field is a date field that I have modified in the custom
display to show only the month and year. The 4th and final field (the
reason for this question) is the one I having a problem with now. I
currently have it as a calculation field that is supposed to take the
2nd field (which should be a 5 or a 10) and then add it to 3rd field
for the number of years and telling it that the result is a date. An
example display of what I want is below.

red 5 1/2005 1/2010
red 5 3/2005 3/2010
green 10 6/1998 6/2008

The problem I'm having is that two-fold. One the dates for the 4th
field are really wacky. Using the above example the 4th field displays
11/30/0011. The calcution I used was Date( Month("3rd field"),
Day("3rd field"), Year("3rd field") + "2nd field") where the "xxx
field" is replaced with the current fields name and telling the
calculation field the result is a date. I was trying to simplify for
the example, but I may have have confused things all the more with my
example. Sorry. The 2nd problem would be to have the the calculation
display the answer in the same format as the 3rd field.
If it will help I can send a copy of the file (with most of the
records deleted due to size, but everything else intact) through email.

Reply With Quote
  #2  
Old   
Dan Fretwell
 
Posts: n/a

Default Re: Dates and Calculation fields - 12-14-2005 , 05:13 AM






I don't have v5.5 but I do have v3 and your formula works perfectly
well in that situation. I have tried to reproduce the wierd date
behaviour you have and I could only do it to some extent by including
the quotes around the field names - maybe that is the problem. You
should have

Date(Month(field3),Day(field3),Year(field3) + field2)


Reply With Quote
  #3  
Old   
Dan Fretwell
 
Posts: n/a

Default Re: Dates and Calculation fields - 12-14-2005 , 05:17 AM



Missed the formatting. As field4 is a date field you can apply the same
custom format as field3.


Reply With Quote
  #4  
Old   
Remi-Noel Menegaux
 
Posts: n/a

Default Re: Dates and Calculation fields - 12-14-2005 , 06:08 AM



If you still can't make it, you may send me your file with a few
records.
Rémi-Noël

"Lee Steffeck" <final (AT) xdcomcast (DOT) net> a écrit :
Quote:
I am trying to get a calculation field to work by adding so many
years from a date and another calculation field. I'm using FMP 5.5 on
a Windows XP machine. More details are below.
The first field is a text for what the equipment is in a pop up list
and the 2nd field is calculation using the case function. This way if
I select "red" in the pop up list, the calculation will display a 5
but
if I choose "green" then a 10 will be shown. This is for the number
of
years in the future when the next maintence is due.
The 3rd field is a date field that I have modified in the custom
display to show only the month and year. The 4th and final field (the
reason for this question) is the one I having a problem with now. I
currently have it as a calculation field that is supposed to take the
2nd field (which should be a 5 or a 10) and then add it to 3rd field
for the number of years and telling it that the result is a date. An
example display of what I want is below.

red 5 1/2005 1/2010
red 5 3/2005 3/2010
green 10 6/1998 6/2008

The problem I'm having is that two-fold. One the dates for the 4th
field are really wacky. Using the above example the 4th field
displays
11/30/0011. The calcution I used was Date( Month("3rd field"),
Day("3rd field"), Year("3rd field") + "2nd field") where the "xxx
field" is replaced with the current fields name and telling the
calculation field the result is a date. I was trying to simplify for
the example, but I may have have confused things all the more with my
example. Sorry. The 2nd problem would be to have the the calculation
display the answer in the same format as the 3rd field.
If it will help I can send a copy of the file (with most of the
records deleted due to size, but everything else intact) through
email.



Reply With Quote
  #5  
Old   
Lee Steffeck
 
Posts: n/a

Default Re: Dates and Calculation fields - 12-15-2005 , 07:39 AM



<snip>

Hmmmm, if it worked for you then I will just create a new database
and try it from scratch. I may have something left over or forgotten
something in the file. I'll report more later. Thank you both.

Reply With Quote
  #6  
Old   
Helpful Harry
 
Posts: n/a

Default Re: Dates and Calculation fields - 12-15-2005 , 01:45 PM



In article <151220050639071999%final (AT) xdcomcast (DOT) net>, Lee Steffeck
<final (AT) xdcomcast (DOT) net> wrote:

Quote:
snip

Hmmmm, if it worked for you then I will just create a new database
and try it from scratch. I may have something left over or forgotten
something in the file. I'll report more later. Thank you both.
Are you sure the field types are correct??
Are all the brackets in the correct place??

They should be:

Date(Month(DateField), Day(DateField), Year(DateField) + NumberField)

Also check the formatting for the field on the layout isn't set to
something peculiar.

Helpful Harry
Hopefully helping harassed humans happily handle handiwork hardships ;o)


Reply With Quote
  #7  
Old   
Lee Steffeck
 
Posts: n/a

Default Re: Dates and Calculation fields - 12-20-2005 , 08:01 PM



In article <141220050110385273%final (AT) xdcomcast (DOT) net>, Lee Steffeck
<final (AT) xdcomcast (DOT) net> wrote:

Quote:
I am trying to get a calculation field to work by adding so many
years from a date and another calculation field. I'm using FMP 5.5 on
a Windows XP machine. More details are below.
The first field is a text for what the equipment is in a pop up list
and the 2nd field is calculation using the case function. This way if
I select "red" in the pop up list, the calculation will display a 5 but
if I choose "green" then a 10 will be shown. This is for the number of
years in the future when the next maintence is due.
The 3rd field is a date field that I have modified in the custom
display to show only the month and year. The 4th and final field (the
reason for this question) is the one I having a problem with now. I
currently have it as a calculation field that is supposed to take the
2nd field (which should be a 5 or a 10) and then add it to 3rd field
for the number of years and telling it that the result is a date. An
example display of what I want is below.

red 5 1/2005 1/2010
red 5 3/2005 3/2010
green 10 6/1998 6/2008

The problem I'm having is that two-fold. One the dates for the 4th
field are really wacky. Using the above example the 4th field displays
11/30/0011. The calcution I used was Date( Month("3rd field"),
Day("3rd field"), Year("3rd field") + "2nd field") where the "xxx
field" is replaced with the current fields name and telling the
calculation field the result is a date. I was trying to simplify for
the example, but I may have have confused things all the more with my
example. Sorry. The 2nd problem would be to have the the calculation
display the answer in the same format as the 3rd field.
If it will help I can send a copy of the file (with most of the
records deleted due to size, but everything else intact) through email.
Thank you again Dan, Remi-Noel, and Harry. I redid the whole in a
new database and found the problem. I did not put the paranthes marks
(the "(" and the ")" ) around the 2nd field. Once I did it worked
fine. Thank you thank you thank you.


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.