10-07-2019 05:07 AM
Hello.
I am trying to make a program that makes a meal plan and shopping list for the week, from a set of predefined recipes.
The way it works is that I have a excel document with the different recipes, ingredients and how much of each ingredient. Then the program makes a list of X different recipes and combine all the ingredients to a shopping list.
So, in the end I have 2 arrays. One being a text array with the name of the ingredient and the other a numerical array with how much of each ingredient.
Here is my problem. I would like to delete duplicates on my text array and then add the numbers together on the numerical array. I will try to formulate an example below.
I have one text array with the items eg: [Milk, Flour, Sugar, Milk, Milk, Ketchup] and another with the numbers of how many pieces of the items I want to buy eg: [1, 1, 2, 3, 1, 1].
In this example I would like to sum up all the entries of milk, so I would end up with [Milk, Flour, Sugar, Ketchup] and [5, 1, 2, 1]. I hope this makes sense.
Solved! Go to Solution.
10-07-2019 05:35 AM - edited 10-07-2019 05:37 AM
Hi Marcus,
use a LUT (look-up table) based on variant attributes (or a map/set in LV2019).
(A very similar question came up recently.)
10-07-2019 03:46 PM
How will you combine all of the different units of measurement that could be used for recipes and convert that into a store bought unit? For example, milk is typically measured in cups or mL but it bought in gallons or liters. If one recipe uses cups and another uses mL, you'll need a conversion factor to be able to combine them. Just something to consider.
Is this a practical application that you plan to use at home or is it a school project?
10-07-2019 09:50 PM - edited 10-07-2019 09:51 PM
Hello Marcus,
Please find the attached VI that gives you the required solution.I have used a VI from OpenG Library and I have attached it too.
Hope it helps, Let me know if my understanding to your problem is right.
Thanks
Rahul
Click KUDOS and Mark as Solution to convey Thanks
10-08-2019 03:41 AM
Hey aputman, that is a good point. I think that I will start with getting it to work with just being consistent with my units in my recipe spreadsheet and only using liters for milk and so on.
This is just a fun project for home, but if it comes to work really well then I might use it to do my weekly meal and shopping plan.
10-08-2019 03:43 AM
Hello Rahul.
Thank you so much, this does exactly what I asked for. thank you so much!
10-08-2019 04:04 AM
Welcome.
Thanks
Rahul
Hit KUDOS for Thanks