Filtering Lists by a field that contains multiple sub-fields

56 views
Skip to first unread message

MagoArcade

unread,
Jul 20, 2019, 11:42:42 AM7/20/19
to TiddlyWiki
TiddlyWiki is making my brain hurt. I'm following the white rabbit down the relevant hole and I can't handle the meta. 

So - I'm an amateur coder - so do bear with me - this aint my day job. It's taking some adjustment - even to using the online documentation! 

I'm using TiddlyMap. Here's how it looks:

map3.png

Any tiddlers made by tiddlymap have a couple of extra fields, tmap.edges and tmap.id:


map4.png


Now, tmap.edges appears to contain sub-fields within it. TestUserTask tmap.edges full value is (verbatim):


{"49655fa4-e3ff-4ef8-a776-d9c915b372ca":{"to":"087aa75e-ec77-4cd2-a774-c41c0ee52382","type":"SubTaskOf"}}


What I am trying to do is write a filter to do the following:

  1. Identify all tiddlers that have a value in "tmap.edges" (thus no nulls) and also those where "type" = a specific value (in this instance equalling "SubTaskOf")
  2. I'd also like to know how to display any other data from these arrays within a field (for example in this instance, sharing the 1st and second values in the return from tmap.edges)
Closest I've got so far is successfully filtering by another field value (in this case, tmap.id due to not knowing how to access the sub-field):

<$list filter="[field:tmap.id[2441c2d3-1b64-4edc-83cd-4f05b91daab3]]">

{{!!title}} :
{{!!tmap.edges}}
</$list>

Produces:

TestUserTask : {"49655fa4-e3ff-4ef8-a776-d9c915b372ca":{"to":"087aa75e-ec77-4cd2-a774-c41c0ee52382","type":"SubTaskOf"}}

Whilst this is displaying all of the values of tmap.edges, it's just displaying the full string, not the component fields. 

I'd appreciate any help. I'm slowly getting that what you get with TiddlyWiki is an incredibly powerful knowledge framework. However, it's one's responsibility to form it into the functionality you want (in my instance a software development planning tool). 

Steve








 

Watt

unread,
Jul 20, 2019, 1:17:18 PM7/20/19
to TiddlyWiki
Hi Steve
Tiddlymap is a beautiful thing! There was a similar question just the other day - I hope Mat doesn't mind me quoting his answer to that;

"TiddlyMap is a project from one individual, Felix Kupper / Felix Hayashi. I doubt anyone else can answer but he is, as far as I know, not very active in the community. At least he is not seen in this discussion group. If I were you, I'd post an issue on the TiddlyMap github repo. He is a very friendly guy so if he can, he will probably reply."

The github repo is here;
https://github.com/felixhayashi/TW5-TiddlyMap

Hope you find an answer and can come back here and share the magic. Good luck!

MagoArcade

unread,
Jul 20, 2019, 1:26:46 PM7/20/19
to TiddlyWiki
Thanks for the answer, Watt. Miraculously (I have no idea how) I managed to solve it myself. It's probably hacky and would welcome a more eloquent answer, but I used a combination of regex and a variable to hold it (even used that there 'transclusion' to hold the variable value in a tiddler + then populate the variable from this!). Escaping characters seems to be a bit of a black art.

For completeness, the working code:

<$set name=regex value="{{regexSubTaskOf}}">


<$list filter="[regexp:tmap.edges[SubTaskOf]]">
{{!!title}} :
{{!!tmap.id}}
</$list>


</$set>

where 'regexSubTaskOf'=

"type":"[A-Za-z].*"

Results:

User Chooses scraper : 70ca072d-9243-4f08-b0aa-8c7f0f715cae

User chooses default region : 53b18c6b-4924-4545-9e50-e365323f372c

Update ogz db User Action : ed759eb2-dde8-4bf1-b9e3-8473c76c474f

UserManager.AddUser : cd9eb9bb-4437-4bf1-918a-8e08425641b8

UserManager.AddUser.CheckIfExists :e27391cb-4e9b-4794-9c58-8a1fd018adae

TestUserTask : 2441c2d3-1b64-4edc-83cd-4f05b91daab3

The top few are on a different map, but are all 'SubTaskOf'

Weirdly, I wanted the names to display as tiddlers, so I could drag and drop them. Those without space do this, but those with don't. More rabbit hole plunging to do.....

I got into TiddlyWiki to help with task, planning and design processes for my coding. I didn't realise I'd find a new coding environment to enjoy!

Watt

unread,
Jul 20, 2019, 2:00:22 PM7/20/19
to TiddlyWiki

MagoArcade

unread,
Jul 20, 2019, 3:04:55 PM7/20/19
to TiddlyWiki
Loved that song - "feed your head" indeed!

On Saturday, 20 July 2019 19:00:22 UTC+1, Watt wrote:
50 years ago!

https://youtu.be/Vl89g2SwMh4

Reply all
Reply to author
Forward
0 new messages