David,

Herre is a little code from and existing solution I built

The fieldnames are extracted from the data tiddler and a list of only those 
"checked" is displayed in read only view, in edit view a checkbox is 
presented for all fieldnames.

This is read only/view
<$list filter="[[$:/data/industry-experience-fields]indexes[]]" 
variable=fieldname>
    <$list filter="[all[current]get<fieldname>match[yes]]" variable=nul>
       <$text text={{{ [[$:/data/industry-experience-fields]getindex
<fieldname>] }}}/><br>
    </$list>
</$list>


This is edit or checkbox mode
<$list filter="[[$:/data/industry-experience-fields]indexes[]]" 
variable=fieldname>
  <$checkbox field=<<fieldname>>  checked="yes" unchecked="no" 
default="no"> <$text text={{{ [[$:/data/industry-experience-fields]getindex
<fieldname>] }}}/></$checkbox><br>
</$list>

Regards
Tony

On Tuesday, March 17, 2020 at 1:02:36 AM UTC+11, 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/f8ef2f3a-daf6-47e4-b77d-7e225c09e96e%40googlegroups.com.

Reply via email to