# Harvest CSV Export

**URL:** <https://farmos.discourse.group/t/harvest-csv-export/1095>\
**Category:** Using farmOS\
**Tags:** feature-request\
**Created:** [January 28, 2022, 11:35am UTC](https://farmos.discourse.group/t/harvest-csv-export/1095 "2022-01-28T11:35:04Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![berrycw](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@berrycw](https://farmos.discourse.group/u/berrycw)\
**Post date:** [January 28, 2022, 11:35am UTC](https://farmos.discourse.group/t/harvest-csv-export/1095/1 "2022-01-28T11:35:04Z")

</div>

I am new to FarmOS and I am playing around V2 to see how things are going to work for my operation.

We have berry orchards and I like to keep track of harvests. To make this a bit easier I will make this in point form:

- added an asset called ‘berries’ under materials
- added a ‘Harvest’ log and in the log quantity section selected to increase the ‘berries’ asset by the amount harvested
- check the Quantities - Material record shows no logs created
- check the Asset ‘berries’ under the tab inventory it shows the harvest log and amount correctly

Am I missing something or is the Quantities - Material not linked?  
Also can an Export CSV function be added to the Inventory tab for Assets?

---

<div class="post-metadata">

**Author:** ![mstenta](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/mstenta/32/4_2.png) [@mstenta](https://farmos.discourse.group/u/mstenta)\
**Post date:** [January 28, 2022, 12:26pm UTC](https://farmos.discourse.group/t/harvest-csv-export/1095/2 "2022-01-28T12:26:35Z")

</div>

Hi @berrycw - welcome to the community! 😃

> Am I missing something or is the Quantities - Material not linked?

Ah this is a great question - and probably points to something we just need to clarify better in the UI perhaps. The word “Material” is used in a few different places, and I think that’s the cause of the confusion…

The TL;DR (summary) is basically this: There are two different ways you can work with “materials” in farmOS v2… 1) tracking actual material **assets** (including their inventory levels), and/or 2) simply referencing what _types_ of materials were used in **quantities**.

The former allows for very granular _tracking_ of actual materials, and was introduced as a new feature in v2. The latter was a simple (less granular) way of _referencing_ material types used on Input logs specifically, which was the only option available in v1.

I’ll try to explain the recent history that led to this:

- In farmOS v1, before we had a “Material” asset type, we _only_ had a taxonomy called “Materials”, which allowed you to create a list of the different types of materials you use as inputs, primarily. The “Input” log type had a “Material” field for referencing terms in this vocabulary (as a way to “tag” input logs with the material that was used, essentially).
- In farmOS v2, we added a new “Material” asset type, so you could track ACTUAL materials you are managing, and we renamed the “Materials” taxonomy to “Material type” to better differentiate it and clarify that it was for “types” of materials, not your “actual” materials.
  - Notably, Material assets have their own “Material type” field, for specifying what type of material it is (by referencing a term in the “Material types” vocabulary).

- At that time we _removed_ the “Material” term reference field from Input logs, and created a new “Material Quantity” type (alongside the old “Standard Quantity” type), which has a “Material” term reference field. So basically: the field moved from the _Input log level_ to the _Material Quantity level_. This served two purposes:
  1. It maintained the ability to reference material types, so that people migrating from v1 to v2 would not lose that valuable information. (The automated migration logic copies data from the log to a new quantity in v2.) This is important for data preservation, but _also_ because _not everyone_ needs to track granular material assets (eg: someone using farmOS for organic certification record keeping _only_ needs to show what _type_ of material was applied - certifiers don’t care about inventory). Different operations use farmOS for different levels of granularity.
  2. It made it possible for a single Input log to reference _multiple_ Material types (which was possible in v1) AND tie them directly to specific quantities that were used for each (which was not possible in v1).

Here is one of the relevant threads in the issue queue where this was all discussed/decided upon: [https://www.drupal.org/project/farm/issues/3196834](https://www.drupal.org/project/farm/issues/3196834)

Getting back to _your_ use-case specifically…

It sounds like you want to track inventory of your berries via harvest logs. So the way you recorded this (via a Standard quantity on a Harvest log, incrementing the inventory of your Material asset) is the right way to do it! You don’t need to use Material Quantities for this at all, you can just use Standard Quantities.

(To be clear, you _could_ use a Material quantity, but then you would be referencing the Material Type in BOTH the Asset AND the Quantity, which would be redundant.)

The only thing that was confusing is you expected that these quantities would show up under Records \> Quantities \> Material - and that’s understandable! The labeling is confusing - we should think about ways to make this more clear, if possible. At the very least we can add some help text at the top of the Records \> Quantities \> Material page to describe exactly what it is a list of, and similarly on the Records \> Assets \>Material page.

I hope I explained this well enough - and if not maybe someone else will chime in and do a better job. 😅

> Also can an Export CSV function be added to the Inventory tab for Assets?

Great idea! And probably not too difficult… I will add the “feature request” tag to this topic. (See: [How things get built... (from ideas to code)](https://farmos.discourse.group/t/how-things-get-built-from-ideas-to-code/1080))

---

<div class="post-metadata">

**Author:** ![mstenta](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/mstenta/32/4_2.png) [@mstenta](https://farmos.discourse.group/u/mstenta)\
**Post date:** [January 28, 2022, 1:32pm UTC](https://farmos.discourse.group/t/harvest-csv-export/1095/3 "2022-01-28T13:32:28Z")

</div>

I also just created this feature request idea you may be interested in: [Interest in an inventory adjustment quick form?](https://farmos.discourse.group/t/interest-in-an-inventory-adjustment-quick-form/1096)

---

<div class="post-metadata">

**Author:** ![berrycw](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@berrycw](https://farmos.discourse.group/u/berrycw)\
**Post date:** [January 29, 2022, 10:06am UTC](https://farmos.discourse.group/t/harvest-csv-export/1095/4 "2022-01-29T10:06:49Z")

</div>

Thanks Mike.

---

<div class="post-metadata">

**Author:** ![berrycw](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@berrycw](https://farmos.discourse.group/u/berrycw)\
**Post date:** [January 29, 2022, 12:34pm UTC](https://farmos.discourse.group/t/harvest-csv-export/1095/5 "2022-01-29T12:34:44Z")

</div>

Can the Quantity field in the Harvest CSV Export be fixed?

 ![image](https://global.discourse-cdn.com/free1/uploads/farm_os/original/1X/c3ba2a8b58c15ee10d7a6a1774fd4b2a8ec55e4b.png)

 ![image](https://global.discourse-cdn.com/free1/uploads/farm_os/original/1X/c93c8c26506c0d6fdd0b2b81feae04e427964fce.png)

---

<div class="post-metadata">

**Author:** ![pat](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/pat/32/1050_2.png) [@pat](https://farmos.discourse.group/u/pat)\
**Post date:** [January 29, 2022, 1:37pm UTC](https://farmos.discourse.group/t/harvest-csv-export/1095/6 "2022-01-29T13:37:16Z")

</div>

In my quantity overview the exported quantity is working.  
Not the exact same fields, but could maybe help?

---

<div class="post-metadata">

**Author:** ![mstenta](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/mstenta/32/4_2.png) [@mstenta](https://farmos.discourse.group/u/mstenta)\
**Post date:** [January 31, 2022, 11:15am UTC](https://farmos.discourse.group/t/harvest-csv-export/1095/7 "2022-01-31T11:15:24Z")

</div>

Thanks for the bug report @berrycw - I’m seeing that too. It looks like the quantity information is being included, but it has a bunch of newlines in it:

 ![Screenshot from 2022-01-31 06-08-25](https://global.discourse-cdn.com/free1/uploads/farm_os/original/1X/cc9d2950a324afbe4740cca8dcf4604e4dc80b1f.png)

I’ve opened a bug report: [Quantities include newlines in Log CSV exports · Issue #497 · farmOS/farmOS · GitHub](https://github.com/farmOS/farmOS/issues/497)

If you are specifically trying to export quantity data to CSVs, I would recommend using the Records \> Quantities “Export CSV” (filtered by log type) instead of Records \> Logs. This will show one quantity per row, rather than one log per row. So if a log has multiple quantities, you will see multiple rows with the same log name. It also separates the quantity measure, value, units, and label out to separate columns which is better for working with in CSV/spreadsheet format.

The path to try is: `/quantities?log_type=harvest`

---

<div class="post-metadata">

**Author:** ![berrycw](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@berrycw](https://farmos.discourse.group/u/berrycw)\
**Post date:** [March 13, 2022, 12:35pm UTC](https://farmos.discourse.group/t/harvest-csv-export/1095/8 "2022-03-13T12:35:00Z")

</div>

Hi Mike,

Just working with this again as I have some time to figure out how this is going to work for me. Anyway I setup an Material Asset called Frozen Haskap Berries and then added to this asset with harvest records and removed berries using activities. So the overview looks like this:

 ![image](https://global.discourse-cdn.com/free1/uploads/farm_os/original/1X/13d8207e29f78ae98317f45c8ac21bd29cbd754f.jpeg)

If I click on the Frozen Haskap Berry asset link and then select the Inventory tab I get all of the activities rather than a list of current assets and their quantities:

 ![image](https://global.discourse-cdn.com/free1/uploads/farm_os/original/1X/6d4709c84c136c11a3d6432d5088713e9ca60449.png)

The other thing that I have noticed is that I have one asset item listed as Berry Blue Haskap and it has a parent of Frozen Haskap Berries, but for some reason that does not show up under Frozen Haskap Berries. Is this a bug?

---

<div class="post-metadata">

**Author:** ![mstenta](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/mstenta/32/4_2.png) [@mstenta](https://farmos.discourse.group/u/mstenta)\
**Post date:** [March 15, 2022, 2:47pm UTC](https://farmos.discourse.group/t/harvest-csv-export/1095/9 "2022-03-15T14:47:26Z")

</div>

@berrycw The “Inventory” tab on assets is just a list of inventory adjustments for _that_ specific asset. Sorry if that is unclear - perhaps we need to add a bit of help text to the top.

Ultimately, I think general purpose “Inventory Report” would be a good place to summarize current inventory levels for all assets!

Also related perhaps:

> I think the best next step in this regard would be to create some inventory management quick forms, which can serve as the “canonical” place to go to adjust inventories - with a simple set of input questions and it automatically creates the necessary logs/quantities/references when submitted.

(from [Maintenance Log (v2) - #14 by mstenta](https://farmos.discourse.group/t/maintenance-log-v2/1152/14))

Dedicated forum topic for that: [Interest in an inventory adjustment quick form?](https://farmos.discourse.group/t/interest-in-an-inventory-adjustment-quick-form/1096)

> The other thing that I have noticed is that I have one asset item listed as Berry Blue Haskap and it has a parent of Frozen Haskap Berries, but for some reason that does not show up under Frozen Haskap Berries. Is this a bug?

Hmm I might need to better understand what you’re trying to achieve?

Asset parent relationships can be used in two different ways in farmOS:

1. “Location” assets use parent relationships to represent hierarchies.
2. Non-location assets use parent relationships to represent genetic lineage.

If you are looking at a location asset, you should see a “Locations” tab at the top, which will show a page that displays the hierarchy of child locations.

If you are looking at a non-location asset, you should see a “Children” tab at the top, which will show a list of assets that reference the current asset as a parent.

Does that makes sense?

---

<div class="post-metadata">

**Author:** ![berrycw](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@berrycw](https://farmos.discourse.group/u/berrycw)\
**Post date:** [March 17, 2022, 1:52pm UTC](https://farmos.discourse.group/t/harvest-csv-export/1095/10 "2022-03-17T13:52:15Z")

</div>

> [@mstenta](#):
>
> Ultimately, I think general purpose “Inventory Report” would be a good place to summarize current inventory levels for all assets!

This is exactly what I am looking for. Otherwise it is going to be very painful for me to keep track of what we have in stock and what we do not have in stock.

As for the non-location asset I was thinking is to make one asset such as ‘frozen berries’ and then I could have children from that asset such as ‘frozen blackberries’, ‘frozen raspberries’, etc and then I could just look at the asset ‘frozen berries’ and it would give me a breakdown of quantities that make up the parent asset.
