I have some tiddlers in which some things have been recorded. I have used several fields to express the different aspects of those things for every tiddler. To ensure consistency, I have defined some data tiddlers. For example, the content of one is as follows:
00: Unknown
01: Level1
02: Level2
03: Level3
99: Unsuitable
The Tiddler has the name LevelCode.
After I finished editing the LevelCode Tiddler, the sentence below worked well.
{{LevelCode##01}}
Then, I needed to show a list of things, so I drew up a sentence like this:
<$list filter="[tag[Things]]" counter="counter">
<div>
<<counter>> , ''<$text text={{{[<currentTiddler>get[title]]}}}/>'' , ''<$text text={{{[<currentTiddler>get[t.level]]}}}/>'' .
</div>
</$list>
The output is like this:
1 , 2023001 , 01 .
2 , 2023002 , 02 .
3 , 2023003 , 01 .
4 , 2023004 , 03 .
All things look well until now.
The problem is that in the given output, the meaning of level needs to be translated by the reader. It is obviously not friendly to the reader. Thus, I tried to use some JSON operators to handle this issue. When I used jsonget operator, I found that the dictionary tiddler was not supported (maybe my wrong use). So I transformed the dictionary Tiddler to JSON toddler, like this:
{
"00": "Unknown",
"01": "Level1",
"02": "Level2",
"03": "Level3",
"99": "Unsuitable"
}
The sentence {{LevelCodeJson##01}}
worked also.
Some sentences worked well, as follows:
<$set name="myVariable" tiddler="LevelCodeJson" >
<$text text=<<myVariable>>/>
<$text text={{{ [<myVariable>jsonget[03]] }}} />
</$set>
The results were:
{ “00”: “Unknown”, “01”: “Level1”, “02”: “Level2”, “03”: “Level3”, “99”: “Unsuitable” }Level3
My problem is that some sentences do not work because the key recorded in the field “t.level” in the Tiddlers tagged “Things” cannot be transcluded correctly, i.e., the sentences below do not work as expected.
<$list filter="[tag[Things]]" counter="counter">
<div>
| <<counter>> | ''<$text text={{{[<currentTiddler>get[title]]}}}/>'' | ''<$text text={{{[<currentTiddler>get[t.level]]}}}/>'' | {{LevelCodeJson##<$transclude $field="t.level"/>}} | <$text text={{{ [<myVariable>jsonget[<$transclude $field="t.level"/>]] }}} /> |
</div>
</$list>
In my understanding, either {{LevelCodeJson##<$transclude $field="t.level"/>}}
or <$text text={{{ [<myVariable>jsonget[<$transclude $field="t.level"/>]] }}} />
does not work. Namely, anything is not shown in the output.
What’s wrong? How to use some means to show the value rather than the key(index) in the output so that the result is shown like this?
1 2023001 Level1
2 2023002 Level2
3 2023003 Level1
4 2023004 Level3