Jump to content

This topic is 8348 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hello all

I'm halfway there on this, and stuck.

I want to be able to make up the following utility as part of a solution. It's to determine either the planting date or the picking date for seedlings.

Say I've got two vegetables, capsicums and eggplant (in reality the solution has 20-30). If planted in January capsicums take 29 days before picking, February also 29, March 20, April 35, May 42.

Eggplant take 21, 21, 26, 30, 32 respectively.

Given that a client may give you either the planting date or the picking date so you want to plug in either date and come up with the other one.

How would you structure a solution to take into consideration the different vegetables and different dates according to time of year?

Now someone kindly helped me out a little on this. So now what I've got is another file with variety (primary key), then january, february etc.

I've worked out how to get it to look up this related file, then go to the right variety and add say 29 days onto the planting date to get a picking date, so the first part is over. But it doesn't look past the January field. Now I need to say 'okay look at the date put in as a planting date, and add the right number of days to it according to the time of year'. In other words if it's January add 29 days, February add 29, March add 20 etc.

Is this a case of using an 'if' statement, and if so, how?

Thanks to anyone who digs me out of this hole.

Drew

Posted

Let's see if this will get your veggies growing....

I'm assuming the records in each file are the veggies and that you have month fields in the 2nd file for the growing time for each veg (growing_time_jan etc.) Create a relationship between the 2 files (Veggies in this example).

In the first file, create 2 date fields: data_entry_planting and data_entry_picking.

Create a date calculation field picking_date defined as follows:

Case(Month(data_entry_planting) = 1, data_entry_planting +Veggies::Growing_time_Jan, Month(data_entry_planting) = 2, Data_entry_planting +Veggies::Growing_time_Feb, etc. for all the months)

And another one planting_date as follows:

Case(Month(data_entry_picking) = 1, data_entry_picking - Veggies::Growing_time_Jan, Month(data_entry_picking) = 2, Data_entry_picking -Veggies::Growing_time_Feb, etc. for all the months)

If you don't want two sets of date fields visible on your layout, you can hide the calculation fields behind the data entry fields and set them to disallow entry. Make sure the data entry fields above them are transparent.

"Il faut cultiver notre jardin." - Voltaire

This topic is 8348 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.