@Brian_Radspinner I think the code pattern within your example and variations of it is a useful approach to this and similar problems. In this one you are nesting the lists, but we can also use the format date (to different periods like YYYY) then the each:value[] to get a list of those values, we can save this in a variable, using $set filter=
in this case the years in our data set.
- Then we can use this as the outer group
- Then we could go on to determin another set of the form YYYY0MM
- No need in this case because this is the key to inner group
If this set of years, is in a variable, before we use it we could give the user the opportunity to select from that set and use the result to itterate the data.
- I am interested in exploring this pattern because it is a way to allow selection of a range of date based on the date itself.
- Note
each:value[]
seems equivalent tounique[]
I will edit this reply and give an example, the following example uses journal entries with a journal-date
\function month-heading() Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec +[nth<month>]
<$set name=journal-years filter="[get[journal-date]format:date[YYYY]each:value[]!sort[]]">
''Years to include: ''<$list filter=<<journal-years>> variable=year>
<$checkbox listField="temp-years" checked=<<year>> unchecked=""> <<year>>,</$checkbox>
</$list>
<$list filter="[enlist{!!temp-years}]" variable=year>
<details><summary>Year <$text text=<<year>>/></summary>
<$list filter="[range[12],[1]pad[2]]" variable=month>
<$let date-prefix={{{ [<year>addsuffix<month>] }}}>
<details><summary><<month-heading>> ^^<$text text=<<year>>/>^^</summary>
<$list filter="[has[journal-date]!nsort[journal-date]] :filter[get[journal-date]prefix<date-prefix>]">
</$list>
</details>
</$let>
</$list>
</details>
</$list>
</$set>
And looks like this;
- After opening Year 2023 and Month Dec
Notes;
- Notice how month-heading is an array that uses
<<month>>
to find an entry in it. - Selecting the years shows how we can use and save such parameters for perfomance
- There are 12 month in any years so I generate them rather than look them up, (we could have empty months, so you could add a count of journals to the month summary).