8 Replies Latest reply on May 21, 2015 1:16 AM by siplus

# Calculate date field and number field

It is a way to make calculations like excel that combine the plantedDate+DTH=ExpHarvest. I have been trying different things in file maker and it doe not work. I am not sure because it is a date field and a number field.

 PlantDate DTH ExpHarvest Harvest Wk # 1/1/2015 364 12/31/2015 52
• ###### 1. Re: Calculate date field and number field

mariaocheltree wrote:

I have been trying different things

Have you tried

PlantDate + DTH

in a calculation field of type “date”?

• ###### 2. Re: Calculate date field and number field

Yes I did and the ExpHarvestDate is blank

• ###### 3. Re: Calculate date field and number field

What can I say …?

Check your original data and data types, since: GIGO.

• ###### 4. Re: Calculate date field and number field

Here is a single Let() calculation which might show you how to set this up:

Let ([  // declare the variables you want to use

date = GetAsDate ( "21/05/2015" ) // input here must be a date. In place of my GetAsDate() function, use your PlantDate field

; dth = 364 // if DTH is a field, use that here

; expH = date + dth // if ExpHarvest is a separate field, this is the calculation to use for that field; set calc result to Date

; Hwk = WeekOfYear ( expH ) // if HarvestWk is a separate field, use this calc; for the expH variable, substitute the name of your ExpHarvest field

] ;  // declare the result calculation;  you can set any calculation result you like here

" Expected harvest date: " & exph & " (week no. " & Hwk & " of " & Year ( expH ) & ")"

)

• ###### 5. Re: Calculate date field and number field

My Plant date field is a Date type

DatetoHarvest field is a number type

ExpHarvestDate field is a Date type

• ###### 6. Re: Calculate date field and number field

Good; does the record with the blank result have any data in the first two fields?

That's the usual sanity check, because, as you can see,

earlierDate + number = laterDate

does work (as does laterDate - number = earlierDate).

• ###### 7. Re: Calculate date field and number field

Another sanity check...is the field of type Calculation with a Date result or of type Date with an auto-enter calculation?

It should be the former.

• ###### 8. Re: Calculate date field and number field

have you tried

date( month(plantedDate );  day(plantedDate) + DTH ;  year(plantedDate)  )

?