I have a structured json data tiddler name "projects", which looks like
this:
[
{ "project": "pleiade", "name": "Pléiade v5", "url":
"http:pleiade.test.acmeserver.com" },
{ "project": "rnvp", "name": "RNVP preprod", "url":
"https://rnvp.preprod.acmeserver.com" },
{ "project": "ars", "name": "application de réservation de salles",
"url": "http://ars.test.acmeserver.com" }
]
I want to show this a list sorted on the "name" field. This is the sorting
part which I struggle to get, unsuccessfully.
I have installed the jsonmangler plugin. I can't find a reherence doc
though. With numerous tries, I've been able to get my list, but not sorted.
I have this idea to constitute a list of tiddlers where each item is
"name^index" where name is the name and index the index of each record.
Then I wold sort the list and reduce it to the index part to get the sorted
list of index which would enable me to achieve the display I want.
But I cannot build this name-index list. I have the list of the names in
the natural order and the list of numbers which are the natural indexes of
the items. I can then get a list list like "t0 t1 t2 0 1 2". I can in fact
be a little clever and build "t0 t1 t2 ^0; ^1; ^2;" instead and then what
I need is getting "t0 ^0; t1 ^1; t2 ^2;". This is the critical step I don't
know how to do.
(because from there I would join it in "t0^0;t1^1;t2^2;", split that along
the ";" character and get the list of name^index I wish.)
I know how to do it manually in the case of three records, like this:
<ol>
<$list variable="demo" filter="[enlist[t0 t1 t2]append[^0; ^1;
^2;]move:-2[^0;]move:-1[^1;]join[]split[;]!is[blank]]">
<li><<demo>></li>
</$list>
</ol>
So the general idea would be to generate the part like
"move:-2[^0;]move:-1[^1;]" from the number of records. That is beginning to
be very complex for what that is, how common this seems to be to me. So
surely there is a nicer way to do it.
thanks in advance,
--
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/67051567-db70-45fd-b838-6f9fe69a04cdn%40googlegroups.com.