This is a slightly different approach that I've used before. The names are all fetched in a form where they can be wikified, turned back into a list, and then sorted. Then a lookup is done by name for each item and the project is extracted. I think from this you can see how you would proceed with extracting the URL as well. For this to work of course, the names have to be unique. I called the data tiddler "data" here.
\define getnames() <$vars lb=" [[" rb="]]" sep="$$"><$list filter="[[data]indexes[]addsuffix[/name]]" variable="fetch">{{{ [[data]getindex<fetch>addprefix<lb>addsuffix<rb>] }}}</$list></$vars> \define getprojectbyname(name) <$list filter="[[data]indexes[]]" variable="index"> <$list filter="[<index>addsuffix[/name]]" variable=namepath> <$list filter="[[data]getindex<namepath>compare:string:eq<__name__>]"> <$list filter="[<index>addsuffix[/project]]" variable=projectpath> {{{ [[data]getindex<projectpath>] }}} </$list></$list></$list></$list> \end <$wikify text="""<<getnames>>""" name="names"> <$list filter="[enlist<names>sort[]]" variable="name"> Name: <<name>> <br/> Project: <$macrocall $name="getprojectbyname" name=<<name>> /> <br/><br/> </$list> </$wikify> I've often thought how handy it would be if you could get two outputs from a list instead of just one. e.g. both and index and the index/name value. On Monday, April 19, 2021 at 8:56:23 AM UTC-7 jn.pierr...@gmail.com wrote: > 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 tiddlywiki+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/d80e1a93-e126-4bb6-a019-cebb44e86048n%40googlegroups.com.