So the reason sorting by the "priority" field doesn't work is because the 
field literally contains the text "{{!!severity}}{{!!impact}}". Those 
transclusions only get processed and turned into a series of 1's when the 
field is *wikified*, which normally happens right before it's displayed 
within the tiddler. If you access the priority field through a filter or 
pass it as the value of an HTML/widget attribute, it will still just 
contain the text. (More on wikification. 
<https://groktiddlywiki.com/read/#Wikification>)

That's probably not a great way to do it anyway, since you have to manually 
put that text in every tiddler.

The point of Mike's snippet wasn't the tag part (I don't think tags have 
anything to do with your use case) – that was just a placeholder for 
whatever filter steps you needed to select the relevant tiddlers. The 
important part was the *sortsub* operator, which runs a filter expression 
against each element to determine how to sort it. In your case, I think you 
would want something to the effect of:

\define sortformula() [{!!severity}add{!!impact}]

<$list filter="[status[In House]] [status[With Vendor]] 
+[!sortsub:integer<sortformula>]">
<$link/> (priority <$text text={{{ [{!!severity}add{!!impact}] }}}/>)<br>
</$list>

(For this to work you need to switch to the actual numbers, rather than a 
string of 1's. Also note that the filter you gave above for tiddlers with a 
particular value in the status field is incorrect because it contains a 
space after the word *status* – a space isn't allowed there.)

The {{{}}} allow you to transclude the result of a filter expression 
<https://groktiddlywiki.com/read/#Filters%20and%20Transclusions>...so 
that's how you "view the outcome of the mathematical operations".

On Tuesday, May 18, 2021 at 5:58:08 PM UTC-5 [email protected] wrote:

> Thanks Mike,
>
> so basically i am trying to do is simulate a ticketing tool.. , and assign 
> prioritys to tiddlers i am using as tasks ,  2 criteria(severity , impact) 
> or more  that add up to a given priority/ranking , 
>
> so tiddler A is called " archive data" 
>
> field x is  "severity" and  has value 1111111
> filed Y is  "impact"  and has value 111111111
> Field z is "priority" and  has value {{!!severity}}{{!!impact}} --> 
> translating to 1111111111111111 
>
> tiddler b is called "restart server"
>
> field x is  "severity" and  has value 11
> filed Y is  "impact"  and has value 11111111111
> Field z is "priority" and  has value {{!!severity}}{{!!impact}} --> 
> translating to  1111111111111 
>
>
>
> they also have another field "status" which can be either " In House " or 
> " With Vendor" , so thats another 4th field that will hold any of these 2 
> values .
>
> then...
>
> <$list filter= 
> "[status[In House]][status[With Vendor]]+[sort[priority]]">
>
>
>
> Now ,The reason i am using ones in the field values (ie 11111) is because 
> , i understand you cant do math in fields .. which is another problem ..
>
> but then my thinking was ,i run a filter on all tiddlers which has "In 
> house " or "With Vendor " in the status field values  
> [status [In House]][status[With Vendor]] 
>
> then sort them using the priority field , and that should sort the 
> tiddlers with the higher ranking at top, and thats when i realized the 
> sorting doesn work , hence this post.
>
> i have few questions
>
> if i understood correctly you are saying this can be done using tags 
> instead ? 
> so can it be done using field instead (so instead of  [tag[sortbyfield], 
> could it be [status [In House]?
> also how can i view the outcome of the mathematical operations?
>
> and finally , now that you know what i am after , is there a better way of 
> doing all this ?
>
>
>
>
>
> On Tuesday, May 18, 2021 at 4:41:19 PM UTC+2 [email protected] wrote:
>
>> For instance, in your specific example you could use a filter like 
>> [{!!x}multiply[10]add{!!y}] in the sortsub for your list of tiddlers 
>> containing x and y ... you don't need a z field for this particular use.
>>
>> So if you had a bunch of tiddlers tagged with "sortbyfield" you can do:
>>
>> \define ssfilter() [{!!x}multiply[10]add{!!y}]
>>
>> <$list filter="[tag[sortbyfield]sortsub:integer<ssfilter>]"/>
>>
>> This works for your particular example that you provided because you can 
>> do math in the filter. Not sure how easy it would be in the general sense.
>>
>> /Mike
>>
>> On Tuesday, May 18, 2021 at 9:03:46 AM UTC-3 Michael Wiktowy wrote:
>>
>>> Not exactly what you want but if you can express your combination of 
>>> field x and field y as a filter expression, you should be able to use 
>>> sortsub.
>>> /Mike
>>>
>>>
>>> On Monday, May 17, 2021 at 10:45:20 PM UTC-3 [email protected] 
>>> wrote:
>>>
>>>>
>>>> Hi ,
>>>>
>>>> is it possible to sort transcluded /referenced values?
>>>>
>>>> so i have tiddler 1 which has 3 fields ,field x , field y and field z 
>>>>
>>>> field x = 1
>>>> field y = 2
>>>> field z=  {{!!field x}}{{!! field y}}  --> which translates to "12"
>>>>
>>>> Now i have the same exact thing happening for 4 or 5 other tiddlers 
>>>> with different values for field x and field y , and field z referencing 
>>>> them
>>>>
>>>> now i am doing a list filter , that lists said tiddlers , and putting a 
>>>> sort at the end ..
>>>>
>>>> so something like <$list filter=  criteria ..... and then towards the 
>>>> end     [sort[ field z ]]">
>>>>
>>>>
>>>>  The sort is working, i also used nsort with no luck , so is there 
>>>> something i am doing wrong, or referenced values cannot be used as a 
>>>> criteria for a sort ?
>>>>
>>>> Thanks in advance
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>

-- 
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/74613cc0-aaec-4de6-ab15-e97ddd18096fn%40googlegroups.com.

Reply via email to