Working with list elements

G'day to all,
I am trying to manipulate data in a list. in all exaples of lists i have found each elemet is a single data item E,G list of phone numbers etc. what i have is a list of micro nutrients to a food item so in each element I have
food item serve size salt potasium phosphates
i can save from one list to another so daily to food list
but what i need to be able to do is multiply the micro elements by the serve size in all micro nutrients
so if a food is selected from the food list to be added to the daily list the food in the food list it is saved a 1unit serve size and at recall is multiplied by the new serve size
any ideas would be great , this is the most complicated thing i have tried to do previously all i have created is calculation apps for spacific formulas

Here is a sample set of tables (lists of lists) you can use, based on my current snack:

Reference Tables, set up once when new foods are discovered:

Foods:

  • food name (Utz Witch's Brew Halloween Party Mix) (key)
  • serving size in grams (28)
  • Calories per serving (140)

Food Components:

  • food name (Utz Witch's Brew Halloween Party Mix) (compound key)
  • food component (Total fat) (compound key)
  • food component quantity in grams (8)

Logs:

Daily Food Log:

  • date (20211001)
  • user (ABG)
  • food name (Utz Witch's Brew Halloween Party Mix) (key)
  • food servings consumed (2)

Here are some list manipulation procedures you can use, all draggable:

select_where_equijoin.aia (12.8 KB) SUM_test

P.S. You will need to dynamically create a daily food component consumption log table to answer questions like (How much fat did ABG consume today?) using combinations of the EQUIJOIN and SUM GROUp BY filters.

2 Likes

(#off-topic)
Now THIS is what I call coding!!!

you might want to consider using a relational database for easier selecting and filtering...
also you would save a lot of blocks...
for a local relational database i can offer my sqlite database, see here https://puravidaapps.com/sqlite.php
Probably you want to read this first: What is SQLite and what is a relational database?

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

1 Like

that is awesome , thank you for that ! it is going to take me a while to sort out what is doing what, I never would have figured it out on my own

I will start reding. thank you for your reply