Well look at that, it works! I'm not sure I would have ever gotten there on 
my own, so thank you.

It's just single-bracket macro calls in a filter inside a "super" 
transclusion as a macro parameter. Simple! 😝. I'll understand all this, 
eventually, I hope.

Thanks for the video link. I've been devouring your videos but must have 
forgotten about the ratings portion of that one. I'll rewatch it now.

Jack





On Monday, May 10, 2021 at 3:04:04 PM UTC-4 Soren Bjornstad wrote:

> I think you want:
>
> ```
> <td>
> <$macrocall $name="getStars" numstars={{{ [<currentRecord>get[rating]] }}} 
> />
> </td>
> ```
>
> Worked for me in the wiki you linked.
>
> Also, it looks like you've got this figured out, but I have an example of 
> an implementation of a star rating in one of my YouTube videos if you're 
> curious:
> https://youtu.be/vsdDs7oOLlg?t=2617
>
> On Monday, May 10, 2021 at 1:49:33 PM UTC-5 [email protected] wrote:
>
>> Mohammad,
>>
>> Thank you! Your sample helps me understand how to do this kind of 
>> rendering, though, which is great. (I still seem to overlook using $list 
>> for seemingly everything). 
>>
>> I'm using Tobias' rate plugin for setting and displaying the ratings on 
>> individual tiddlers and it works well. 
>>
>> I'm now working on getting the macro to run correctly when used in a 
>> template in the TiddlyTables plugin. I've tried every combination I can 
>> think of in the column's view template but can't get the macro to "see" the 
>> rating value for each row. If I render a table "by hand" it works fine.
>>
>> Maybe someone can spot an obvious error in my implementation here:
>>
>>   https://rudimentarylathe.wiki/#My Books - TEST
>>
>> There's a custom template for rating that contains the following:
>>
>> ```
>> <td>
>> <$macrocall $name="getStars" numstars={{!!rating}} />
>> </td>
>> ```
>> I feel like I'm going to need "<<currentRecord>>"  somewhere but can't 
>> seem to figure out where.
>>
>> Anyway, thanks for the leg up. I can fall back to my hand-rendered table 
>> easy enough if I can't figure out how to use it in TiddlyTables.
>>
>>
>> On Monday, May 10, 2021 at 10:52:34 AM UTC-4 Mohammad wrote:
>>
>>> Hi Jack,
>>>  The Vote plugin from Kooma Library do rating and you can retrieve stars 
>>> and compare and analyse!
>>>
>>> But if you want your simplest solution the below is one! Wait for 
>>> better, I sure you will get alternatives
>>>
>>>
>>> \define getStars() <$list filter="[range[1,$(vl-stars)$]]">*</$list>
>>>
>>> <$list filter="[all[current]has[rating]get[rating]]" variable="vl-stars">
>>> <<getStars>>
>>> </$list>
>>>
>>>
>>> The above can be used inside a vietemplate if you like to have stars 
>>> automatically displayed!
>>> Adopt if you like to use a table! for a specific tiddler!
>>>
>>>
>>>
>>>
>>> Best wishes
>>> Mohammad
>>>
>>>
>>> On Mon, May 10, 2021 at 7:03 PM Jack Baty <[email protected]> wrote:
>>>
>>>> I have a "rating" field that contains a number from 1-5.
>>>>
>>>> When generating a table (or list) of rated tiddlers, I want to display 
>>>> the rating as a number of stars. e.g. ★★ or ★★★ etc corresponding to the 
>>>> value in rating for each tiddler.
>>>>
>>>> For the life of me, I can't figure out how to do this. Is there some 
>>>> form of string math like "★*rating"? Do I need to choose from a 
>>>> pre-defined 
>>>> list? Do I need to just give up and change the field to contain the actual 
>>>> stars? I'm stumped, sorry.
>>>>
>>>> Jack
>>>>
>>>>
>>>>
>>>>
>>>> -- 
>>>> 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/cc78aa80-95c1-4608-aad8-f41c4d2959b9n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/tiddlywiki/cc78aa80-95c1-4608-aad8-f41c4d2959b9n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>

-- 
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/9f937f0d-2d05-4c94-8016-4dfe48657503n%40googlegroups.com.

Reply via email to