[tw5] Re: Variables in list filters

2019-03-03 Thread S. S.
Reece,

You actually made implementation much smoother by your naming structure, by 
choosing meaningful tiddler titles of System tiddlers templates (and other 
data tiddlers) with the right *suffixes* - such as the names of tiddlers 
and tags they relate to. As you can see by the simplicity of the code that 
works, these choices you made makes both coding and debugging much easier.

Glad the nut was successfully cracked, and hope you have a productive 
outcome!

Regards

On Monday, March 4, 2019 at 9:51:54 AM UTC+7, Reece Shaw wrote:
>
> This worked perfectly! I also better understand how sets work, and on top 
> of that I didn't realize there was a removeprefix operator. Thanks so much! 
> I think I can apply this in a few other ways as well...
>
> -Reece
>
>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/14903f48-afd1-493e-8c4e-46f298743898%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Variables in list filters

2019-03-03 Thread Reece Shaw
This worked perfectly! I also better understand how sets work, and on top 
of that I didn't realize there was a removeprefix operator. Thanks so much! 
I think I can apply this in a few other ways as well...

-Reece

On Friday, March 1, 2019 at 1:20:47 AM UTC-5, S. S. wrote:
>
> Reece,
>
> Maybe using a filter like this in your footer would work:
>
> <$set name="title-remove-prefix" 
> filter="[{!!title}removeprefix[$:/world/faction/]]">
> <$wikify name="fixed-title" text=<>>
> <$list filter="[faction-dominant
> removeprefix[$:/world/location/]]">
>
> 
> 
> 
>
> The complication is that having used multiple templates, the {{!!title}} 
> in the footer pointed to a changed prefixed title.
> The first $set removes the prefix.
> The $wikify changes it to rendered text.
> The $list looks for tiddlers that have that "original" {{!!title}} in 
> their faction-dominant field, then strips the prefix - which gives the 
> tiddler tagged "Location"
>
> Hope that works!
>
> Regards!
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/beed14eb-a4b6-448f-ab17-9db42e32eb40%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Variables in list filters

2019-02-28 Thread S. S.
Reece,

Maybe using a filter like this in your footer would work:

<$set name="title-remove-prefix" 
filter="[{!!title}removeprefix[$:/world/faction/]]">
<$wikify name="fixed-title" text=<>>
<$list filter="[faction-dominant
removeprefix[$:/world/location/]]">





The complication is that having used multiple templates, the {{!!title}} in 
the footer pointed to a changed prefixed title.
The first $set removes the prefix.
The $wikify changes it to rendered text.
The $list looks for tiddlers that have that "original" {{!!title}} in their 
faction-dominant field, then strips the prefix - which gives the tiddler 
tagged "Location"

Hope that works!

Regards!

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/6ec7a636-0f95-499f-98a7-b5326df57d21%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Variables in list filters

2019-02-28 Thread Reece Shaw


On Thursday, February 28, 2019 at 12:58:14 AM UTC-5, Reece Shaw wrote:
>
> Hey All,
>
> I'm currently working on additional features for a campaign/world manager 
> wiki. I'm fond of having dynamic lists that generate based on what the user 
> puts into the wiki. I've run into the below issue:
>
> I have a group of tiddlers tagged "Location" and a group of tiddlers 
> tagged "Faction". The Location tiddlers contain a field titled 
> "faction-dominant" that always contains the title of a single Faction 
> tiddler.
>
> SO in order to maintain consistency I have a "footer" template that is a 
> foldable reveal. I'd like this footer to only display the Location tiddlers 
> where *faction-dominant has a value that matches the title of the tiddler 
> that holds the filter. *
>
> To further complicate things, the filter must first pass the title to a 
> system tiddler where I am storing the fields for editing purposes. The code:
>
> <$list filter="[tag[Location]sort[tags]]" >
>
>
> <$list filter= "[[$:/]addsuffix[state]addsuffix[/]addsuffix{!!title}]">
>
>
> <$list filter= "[has:field[faction-dominant]]">
>
>
> 
> 
> 
>
> I've tried $set and $vars but I am having trouble parsing what exactly I 
> need to set where and documentation is a bit out of my scope of 
> understanding as someone who isn't a trained coder. Any advice?
>
> Thanks,
> -Reece
>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/3bd9a628-9f8f-449f-8d44-acf34ac104fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Variables in list filters

2019-02-27 Thread S. S.
Hello Reece,

It's a little difficult to understand your requirements the way you phrased 
it. I could not understand what is meant by "the title of the tiddler that 
holds the filter" - which filter? The one pasted below? What do you want 
that tiddler to do?

Anyway to get you started - If you have:

*A Tiddler:*
title: A Location Tiddler
tag: Location
faction-dominant: A Faction Tiddler

*Another Tiddler:*
title: A Faction Tiddler
tag: Faction

Put this in the tiddler: A Faction Tiddler
<$list filter="[has[faction-dominant]] +[faction-dominant{!!title}]">



It will only list tiddlers whose *faction-dominant* field contains the 
title of the tiddler this code is in, in this case: *A Faction Tiddler*

If you could try to explain your issue again in a different way, it may be 
easier to understand.

Also the code you pasted - it's difficult to understand what you ware 
trying to do - still it might be improved - you could try this:
[tag[Location]sort[tags]] - the *sort* here is, I think, a little 
meaningless. Perhaps you meant:
[tag[Location]sort[]]

[[$:/]addsuffix[state]addsuffix[/]addsuffix{!!title}] may be better written 
as:
[[$:/state/]addsuffix{!!title}]

[has:field[faction-dominant]] will also find tiddlers that have this 
*faction-dominant* field but it is empty.
[has[faction-dominant]] will only find tiddlers where this 
*faction-dominant* field is NOT empty

Regards

On Thursday, February 28, 2019 at 12:58:14 PM UTC+7, Reece Shaw wrote:
>
> Hey All,
>
> I'm currently working on additional features for a campaign/world manager 
> wiki. I'm fond of having dynamic lists that generate based on what the user 
> puts into the wiki. I've run into the below issue:
>
> I have a group of tiddlers tagged "Location" and a group of tiddlers 
> tagged "Faction". The Location tiddlers contain a field titled 
> "faction-dominant" that always contains the title of a single Faction 
> tiddler.
>
> SO in order to maintain consistency I have a "footer" template that is a 
> foldable reveal. I'd like this footer to only display the Location tiddlers 
> where *faction-dominant has a value that matches the title of the tiddler 
> that holds the filter. *
>
> To further complicate things, the filter must first pass the title to a 
> system tiddler where I am storing the fields for editing purposes. The code:
>
> <$list filter="[tag[Location]sort[tags]]" >
>
>
> <$list filter= "[[$:/]addsuffix[state]addsuffix[/]addsuffix{!!title}]">
>
>
> <$list filter= "[has:field[faction-dominant]]">
>
>
> 
> 
> 
>
> I've tried $set and $vars but I am having trouble parsing what exactly I 
> need to set where and documentation is a bit out of my scope of 
> understanding as someone who isn't a trained coder. Any advice?
>
> Thanks,
> -Reece
>
>

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/7d74ed35-f3d3-41ab-9a5a-f3770d6878d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.