You're kind of making us squint through a keyhole. Why did you use the
variable "item" ? There's probably a good reason, but with only this
information it looks kind of arbitrary.
What I might do is not assign the variable item with the list widget, but
inside it. Then your code might look like
<$list ...etc...>
<$vars item={{!!title}}>
<a href={{{[[
https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=]addsuffix{!!tracking_number}]}}}>USPS
Tracking</a>
... do something with <<item>> ...
</$vars>
</$list>
But, in this case, I don't see what the advantage of <<item>> is over
<<currentTiddler>> .
In general, I would use a variable in a list only if the output is NOT an
actual tiddler or if I didn't want the loop to track <<currentTiddler>> .
That is, sometime the output of a list might be a series of numbers. Those
numbers don't exist as tiddlers, so they're good candidates as variables.
Or sometimes a list widget is used to control number of iterations, so you
might assign a variable "dummy" so that the original currentTiddler value
doesn't get stomped on.
On Monday, June 29, 2020 at 7:23:28 AM UTC-7, David wrote:
>
> Okay, so a related question...
>
> That worked great when I was inside the *one tiddler* that had that
> field.
>
> But what about being in a tiddler that is looping with the ListWidget over
> the tiddlers that all have tracking_number fields ?
>
> The variable item is being set for the loop, as the iterator. So I tried
> this and it didn't work...
>
> <a href={{{[[
> https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=]addsuffix{
> <item>!!tracking_number}]}}
> <https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=]addsuffix%7B!!tracking_number%7D]%7D%7D>}>USPS
>
> Tracking</a>
>
> Thank you!
>
>
> On Monday, June 29, 2020 at 9:15:52 AM UTC-4, Mark S. wrote:
>>
>> What you're trying to do is to concatenate the contents of a field with a
>> string. There are a couple different approaches, often using helper macros.
>> These days, I like to use the {{{ }}} wikitext and a filter that uses
>> "addprefix" or "addsuffix". Like:
>>
>> <a href={{{[[
>> https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=]addsuffix{!!tracking_number}]}}}>USPS
>>
>> Tracking</a>
>>
>>
>> On Monday, June 29, 2020 at 5:50:39 AM UTC-7, David wrote:
>>>
>>> I have this code that tries to put a field value into a link, which
>>> seems logical, but doesn't work...
>>>
>>> <a href="
>>> https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1={{!!tracking_number}}
>>> ">USPS Tracking</a>
>>>
>>> I also tried the transclude code...
>>>
>>> <a href="
>>> https://tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=<$transclude
>>>
>>> field="tracking_number" />">USPS Tracking</a>
>>>
>>> I had originally tried this code, but it seems that external links have
>>> to be put into the html anchor tag.
>>>
>>> [[USPS Tracking|https://
>>> tools.usps.com/go/TrackConfirmAction_input?qtc_tLabels1=<$transclude
>>> tiddler=<<item>> field="tracking_number" />]]
>>>
>>> Thank you all!
>>>
>>
--
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/c6c019f5-969b-4dd7-a869-41c5ad60c620o%40googlegroups.com.