Two-dimensional list/array?

80 views
Skip to first unread message

David Allen

unread,
Dec 31, 2019, 10:10:33 AM12/31/19
to TiddlyWiki
I'm trying to create a wiki for meal tracking, and I'd like to store a list of ingredients and their proportions into recipe tiddlers.  The only way I know to do so right now is by having two lists, one for ingredients, the other for amounts.  Problem is, I'm afraid of doing something to sort one of these lists and disrupt the order between both of these lists.  Does anyone know of a way to create pairs of tiddlers and then store those in a list, or something that will keep these pairs together in a list?  Thanks!

Mark S.

unread,
Dec 31, 2019, 10:47:12 AM12/31/19
to TiddlyWiki

I'm trying to remember how I did it for my own recipe program ;-)

You could have ingredient amount fields, each with a prefix

ing-quinoa
ing-chives
ing-<ingredient tiddler>

where <ingredient tiddler> is the name of a tiddler with a more detailed description of the ingredient.

David Allen

unread,
Dec 31, 2019, 11:13:47 AM12/31/19
to TiddlyWiki
The problem is what I'm doing is a little more in-depth.  I'm tracking macronutrients and calories for each of the ingredients, then totaling those for the overall nutrition facts for the recipe.  Most of the ingredient titles are more than one word, so I'm not sure the solution you've shown would work.

HansWobbe

unread,
Dec 31, 2019, 11:23:57 AM12/31/19
to TiddlyWiki
 Consider TiddlyTables since it provides many possible, sort-able columns.

I've become a real fan of this "all wiki text" solution.

Cheers,
Hans

Mark S.

unread,
Dec 31, 2019, 12:21:47 PM12/31/19
to TiddlyWiki
Only the title needs to be a simple word string.

The actual ingredient can have a caption, description, macronutrients, etc.

Your project sounds similar to one I made for dieting that tracked up to 30 some nutrients. I can look up the link if you're interested.

good luck!

TiddlyTweeter

unread,
Dec 31, 2019, 1:22:37 PM12/31/19
to TiddlyWiki
Mark S. wrote:
... one I made for dieting that tracked up to 30 some nutrients. 

That was neat.

TT

TonyM

unread,
Dec 31, 2019, 8:28:33 PM12/31/19
to TiddlyWiki
David,

I was looking at something similar myself and started building it, not finished yet. The approach I took was to create a field for any ingredient, consider the fieldname it's short name, the field value will then contain the quantity. I then created a tiddler with the title fieldname in which I could store more information on that ingredient including its full name, standard measure eg 1 for a cup and list the recipes tiddlers containing that ingredient (all tiddlers with its fieldname). In each recipie tiddler  you could have a macro <<ingredient "fieldname>> which would retrieve the quantity, full name, link to the ingredient tiddler and display the standard measure.

A smart select would also allow you to add ingredients from existing ones perhaps even with a default qty and while recording a new recipe just create the ingredient fields with a Qty, and deal with the details later.

This solution keeps the tags free for other types of recipe categorisation separated from the ingredients, say international cuisine it belongs to, but this could also become a field.

My ultimate goal would be to allow you to inventory your ingredients and see what recipes you have the ingredients for, or select some recipes and get a shopping list (which you can first satisfy from your pantry).

My key requirement was to be able to clone a recipe tiddler and modify the ingredients a little as I try a variation, then using a rating plugin to review my favorites.

I spend too much time on tiddlywiki so Have resisted finishing this during our festive season.

Regards
Tony
Reply all
Reply to author
Forward
0 new messages