Adding/storing data by year

Im just the grunt labour round the place, its my wife who does the important stuff! - but am trying to tailor farmOS to replace the multiple *doc forms that she produces ATM.(and trying it out with historical data)

I added 2 fields to the animal form - 2019Tuppingdate and 2019Tup.
I assume I can link the 2019Tup data to the lineage when the lamb(s) appear.
And produce a table of lambing dates as TuppingDate+147 days

And next its 2020 .
If I delete my 2019Tuppingdate and 2019Tup fields to replace with 2020Tup & 2020 Date does it also wipe the tables with the 2019 data ? thats what the warning implies , so ive not done it yet

If so id be best having a ā€˜Tupsā€™ data field and leave it . But its convenient to look back and see who has been used in previous years (weve got a limited genetic pool to work with - http://www.orkneyboreray.com )

And the next bit is to produce for the Tups field a list of the equipped rams
(Select from animal where Sex=ā€œMaleā€ AND Equipped NOT LIKE ā€œCastratedā€ ā€¦sort of thing )But I suspect its a LEFT JOIN on cursory glance at the many tables.

if the data is wiped ill just have a bit of the form for archived inputs - that we dont look at again

1 Like

If you want to record when something happened with an asset, ideally that would be represented with a log, not on the asset record itself (we do have a ā€œBirthdateā€ field on assets, but thatā€™s sort of a different storyā€¦).

For Tupping/Breeding, this could potentially be represented with an Activity log that references the sheep. There is an old feature request open to add a dedicated ā€œBreedingā€ log type: https://www.drupal.org/project/farm/issues/2402771

As for calculating lambing dates, based on the tupping date, there isnā€™t a built-in way to do that, but the basic idea would be: find the tupping log that references the asset, and do your calculations based on that. I could see a dedicated breeding module being developed to handle this kind of report in the future!

The benefit of using logs, rather than saving data directly to the asset, is you can have multiple of them, with their own dates (one or more per year), all referencing the asset.

Im new user of the month. thanks, ( i think )

so ive added dates of birth as an activity.
And now I want to produce a page with all the animal assets that belong to a group eg ā€˜2019Lambsā€™ , along with tagID and DoB.
the SQL would (i think be straightforward) but views is very confusing

whats an entity reference ? and a rendered entity ?
and how do i create them ?
to
And i cant find a reference in any of the dropdown menus Iv spent the best part of a week looking at to the Activity to add to anything .

i dont think im completelty stupid (well, perhaps,) .
Its all very confusing ā€¦

1 Like

Do you actually need a custom dedicated page?

If you input the birth date on each animal asset, you can go to /farm/assets/animals e.g. https://farm.example.com/farm/assets/animals then click ā€œfilterā€ and specify a date of birth range:

image

The resulting query url will end up looking something like this:

https://farm.example.com/farm/assets/animals/list?field_farm_date_value[min][month]=1&field_farm_date_value[min][day]=1&field_farm_date_value[min][year]=2019&field_farm_date_value[max][month]=12&field_farm_date_value[max][day]=31&field_farm_date_value[max][year]=2019

Which yields a nice table including the information youā€™re looking for;

1 Like