Adding tags toa tiddler based on value of two other tiddlers

I am trying to create a tiddler that has, as tags, the value from two other tiddlers.

I have tried all sorts of options to no avail. The best I can achieve is the titles of the two tiddlers as tag names in the target tiddler but I can not get the contents of the two tiddlers.

All help appreciated

latest code is

\define maketags()
{{$:/CRC/asset-category}} {{$:/CRC/asset-type}} Assets
\end

''Add a New Asset''

Item: <$edit-text tiddler="$:/CRC/asset-item" tag="input" default=""/>

Category: <$edit-text tiddler="$:/CRC/asset-category" tag="input" default=""/>

Type: <$edit-text tiddler="$:/CRC/asset-type" tag="input" default=""/>

Quantity: <$edit-text tiddler="$:/CRC/asset-quantity" tag="input" default=""/>

Serial Number: <$edit-text tiddler="$:/CRC/asset-serial-number" tag="input" default=""/>

Components: <$edit-text tiddler="$:/CRC/asset-components" tag="input" default=""/>

Approximate Value: <$edit-text tiddler="$:/CRC/asset-approximate-value" tag="input" default=""/>

<$button>
<$action-createtiddler 
     $basetitle={{$:/CRC/asset-item}}
     $template="$:/CRC/CreateTemplate/Assets" 
     $overwrite="yes" 
     title={{$:/CRC/asset-item}}
     asset-type={{$:/CRC/asset-type}}
     asset-category={{$:/CRC/asset-category}}
     asset-quantity={{$:/CRC/asset-quantity}}
     asset-serial-number = {{$:/CRC/asset-serial-number}}
     asset-components = {{$:/CRC/asset-components}}
     asset-approximate-value = {{$:/CRC/asset-approximate-value}}
 />
<$action-setfield $tiddler={{$:/CRC/asset-item}} $field="tags" $value=<<maketags>> /> 
     
<$action-deletetiddler $tiddler="$:/CRC/asset-category" />
<$action-deletetiddler $tiddler="$:/CRC/asset-item" />
<$action-deletetiddler $tiddler="$:/CRC/asset-type" />
<$action-deletetiddler $tiddler="$:/CRC/asset-quantity" />
<$action-deletetiddler $tiddler="$:/CRC/asset-serial-number" />
<$action-deletetiddler $tiddler="$:/CRC/asset-components" />
<$action-deletetiddler $tiddler="$:/CRC/asset-approximate-value" />

Add this asset
</$button>

This adds the tags {{$:/CRC/asset-category}} {{$:/CRC/asset-type}} Assets to the newly create tiddler.

Try this:


''Add a New Asset''

Item: <$edit-text tiddler="$:/CRC/asset-item" tag="input" default=""/>

Category: <$edit-text tiddler="$:/CRC/asset-category" tag="input" default=""/>

Type: <$edit-text tiddler="$:/CRC/asset-type" tag="input" default=""/>

Quantity: <$edit-text tiddler="$:/CRC/asset-quantity" tag="input" default=""/>

Serial Number: <$edit-text tiddler="$:/CRC/asset-serial-number" tag="input" default=""/>

Components: <$edit-text tiddler="$:/CRC/asset-components" tag="input" default=""/>

Approximate Value: <$edit-text tiddler="$:/CRC/asset-approximate-value" tag="input" default=""/>

<$button>
<$action-createtiddler 
     $basetitle={{$:/CRC/asset-item}}
     $template="$:/CRC/CreateTemplate/Assets" 
     $overwrite="yes" 
     title={{$:/CRC/asset-item}}
     asset-type={{$:/CRC/asset-type}}
     asset-category={{$:/CRC/asset-category}}
     asset-quantity={{$:/CRC/asset-quantity}}
     asset-serial-number = {{$:/CRC/asset-serial-number}}
     asset-components = {{$:/CRC/asset-components}}
     asset-approximate-value = {{$:/CRC/asset-approximate-value}}
 />
<$action-setfield $tiddler={{$:/CRC/asset-item}} $field="tags" $value={{{ [{$:/CRC/asset-category}] [{$:/CRC/asset-type}] Assets :and[join[ ]] }}} /> 
     
<$action-deletetiddler $tiddler="$:/CRC/asset-category" />
<$action-deletetiddler $tiddler="$:/CRC/asset-item" />
<$action-deletetiddler $tiddler="$:/CRC/asset-type" />
<$action-deletetiddler $tiddler="$:/CRC/asset-quantity" />
<$action-deletetiddler $tiddler="$:/CRC/asset-serial-number" />
<$action-deletetiddler $tiddler="$:/CRC/asset-components" />
<$action-deletetiddler $tiddler="$:/CRC/asset-approximate-value" />

Add this asset
</$button>

saqimtiaz,

thank you for your suggestion, it worked perfectly.

Your suggestion leaves one question though, what/why/how?

The bracket combination is hardly intuitive.

$value={{{ [{$:/CRC/asset-category}] [{$:/CRC/asset-type}] Assets :and[join[ ]] }}}

I seem to remember from an earlier incarnation as a TW builder, TW Tones produced a document explaining various bracket combinations. I can’t find that anymore. Was that ever incorporated into the TW documentation and if not why not?

Despite that, could someone explain how they reach this bracket combination and how it works?

Could an explanatory entry on various bracket combinations, when and why to use them, be incorporated into the TW documentation.

bobj

Perhaps this Tones GitWiki — For Designers from TW Tones (AKA TonyM) however it is aging quickly with a lot of changes since 5.1.20+

@saqimtiaz is using the format to transclude values into filters. It’s the same as normal transcludes but in filters;

  • Only one curly brace is needed {$:/CRC/asset-category} the text field of $:/CRC/asset-category
  • This need to be inside a filter run [{$:/CRC/asset-category}]its own filter run in this case
    • or say [{$:/CRC/asset-category}match[something]]and [{!!fieldname}]on current tiddler for example
1 Like