I think newcomers sometimes gravitate towards the data tiddler, because it 
seems familiar. But really, the main data element in TW isn't the data 
tiddler, which are pretty limited, but the tiddler themselves. The problem 
with using a data tiddler is that it will record a single bit of 
information for each item. Like "buy/don't buy". But what if you have one 
item that you can get from two different places? Or if you want to indicate 
what kind of product it its (produce, hardware, canned, cleaning, etc.) ? 

The best thing to learn is the list widget, and the filters it uses. 

I use a TW grocery list every week. I suppose I should sanitize it and post 
a version. I haven't kept it up to 5.1.20 capabilities ... but sometimes 
"good enough" is the enemy of "perfect."

Ok, back to your question.

Let's say you have a data tiddler like:

ShoppingSamsClubData 

with

<https://tiddlywiki.com/#> 
Aardvarks: yes 

Kittens: no
Puppies: yes

Then in a tiddler you can put:

<$tiddler tiddler="ShoppingSamsClubData">
<$list filter="[all[current]indexes[]sort[]]" variable=item>
<$checkbox index=<<item>> checked="yes" unchecked="no"/> <<item>><br/>
</$list>
</$tiddler>


And it will give you a dynamic list like (you should see a screen shot here):


I guess if all you ever want is to shop at Sam's club, then you're good to 
go!

HTH

On Monday, March 16, 2020 at 7:02:36 AM UTC-7, David wrote:
>
> Summary:
>
> I'd like to have a list of checkboxes, for a grocery list, that pull data 
> from a DataTiddler.
>
>
> Detail:
>
> I have items I shop for every week and I thought I'd create a tiddler to 
> allow me to uncheck and check items as I shopped.  
>
>
>    - I'd like the *state *of the checkboxes to be stored somehow, I'm not 
>    picky where.  Simpler may be better.
>    - I'd like it to pull the list of items from a *DataTiddler*.  I think 
>    separating the display code from the data would be nice, and I can also 
>    learn about DataTiddlers at the same time.  I'm thinking I don't care if 
>    the state of each checkbox is stored in the DataTiddler or in the tiddler 
>    with the logic.  I guess ideally it would be in the DataTiddler, but at 
>    this point if it is simpler I don't have to.  I have an example where the 
>    state of each box is stored in the logic tiddler's field, which works.
>    - If the data could be stored in more of a CSV style, that would be 
>    nice as well, but not essential.
>    
> I've done a good bit of searching on DataTiddlers and indexes and have 
> found some help, but not a lot.  Here's some code that gives me what I 
> want, but obviously I'd rather not have to add more checkbox commands for 
> each new item I put in the dataTiddler.  I know I can loop over this 
> somehow, right?
>
> But I was unable to find how to successfully loop over the keys in a 
> Dictionary Tiddler.
>
> This works, but is not dynamic...
>
> <$checkbox field="item1" 
> checked='val1'>{{ShoppingSamsClubData##item_01}}</$checkbox>
> <$checkbox field="item2" 
> checked='val2'>{{ShoppingSamsClubData##item_02}}</$checkbox>
>
> And here are the contents of the data tiddler....
>
> item_01: Rice
> item_02: Milk 
>
> *type: application/x-tiddler-dictionary*
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/de84b9c2-1225-419a-b099-547a15102734%40googlegroups.com.

Reply via email to