Simple syntax question: using removePrefix in widget parameter

I’m trying to show a subset of fields, those whose names have a given prefix. I can do that fine, but when I try to remove that prefix from the display, I’m running into a wall I keep hitting: a less than full understanding of when and where I can use certain syntaxes.

So this works almost the way I want:

<$list filter="[<currentTiddler>fields[]prefix[criteria/]first[]]" variable="_">

!!! Criteria

<table>
<tr><th>Name</th><th>Value</th></tr>
<$list filter="[<currentTiddler>fields[]prefix[criteria/]]" variable="listItem">
<tr>
  <td><$text text=<<listItem>> /></td>
  <td><$view field=<<listItem>> /></td>
</tr></$list>
</table>

</$list>

rendering as

Criteria

Name Value
criteria/ruleEffectiveDate 2010-01-01
criteria/ruleExpirationDate 2099-12-31

But when I try to strip those “criteria/” prefixes from my output, I keep failing. The latest attempt:

  <td><$text text="[<listItem>] +[removePrefix[criteria/]]" /></td>

That yields:

Criteria

Name Value
[<listItem>] +[removePrefix[criteria/]] 2010-01-01
[<listItem>] +[removePrefix[criteria/]] 2099-12-31

I’ve tried many syntaxes I know. But obviously not the correct one.

I’m sure this is a simple syntax mistake, but I keep finding these. So first, how do I fix this? Second, is there some shortcut to learning where and when the various syntaxes I’m learning can be applied?

You have to tell the $text widget that you want to evaluate a filter and show the result. The simplest way to do this is to wrap the filter expression in triple braces instead of quotes, like so:

<$text text={{{ [<listItem>] +[removePrefix[criteria/]] }}} />

Your filter expression itself looks OK.

See also https://tiddlywiki.com/#Transclusion and Substitution.

Have a nice day
Yaisog

Also see the different types of widget attributes at https://tiddlywiki.com/#Widgets%20in%20WikiText

I swear I tried that before. But there seem to be so many variants. When I try it now, I get blank values:

Criteria

Name Value
2010-01-01
2099-12-31

Thank you. I will keep reading that and the like until they sink it. In this case, it doesn’t seem to solve the problem.

Example:
tiddlers.json (783 Bytes)

Thank you. I obviously need to keep reading. And rereading, and re-reading until this stuff sinks in.

For some reason, though, Yaisog’s solution didn’t do it for me. I’m pretty sure that was already something I’d tried. Even if not, I just find myself stymied by the simple stuff far too often.

You (and I) need to spell the filter operator name correctly: it’s removeprefix (all lowercase letters).
:disappointed:

D’oh. Years of working in JS, and in Java before that are clearly catching up to me. Thank you!!!

…wandering off muttering to myself, something about “things to double-check before posting”

Thank you for the help!