[tw5] Re: Can I reference a data tiddler using a field value?

2020-01-19 Thread Jim
Thanks all for the help and hints. Some of the examples I couldn't get to work, but finally managed to do what I wanted. This is, at the moment, just experimenting with workflows and what's possible. The under-lying ideas are separation of data from display, linking a tiddler to a data tiddl

[tw5] Re: Can I reference a data tiddler using a field value?

2020-01-18 Thread TonyM
Mohammad Yes, thanks for expanding and giving examples. That's what I mean by; With all the string operators now in filters using the triple braces to wrap a filter is another way to concatenate if necessary. yony -- You received this message because you are subscribed to the Google Groups "

[tw5] Re: Can I reference a data tiddler using a field value?

2020-01-18 Thread Mohammad
post edited: For email readers While Mat and Tony gave good solutions, I may recommend for learning dataTiddlers, read https://kookma.github.io/TW-Scripts/#datatiddler By the way a simple solution may be <$transclude tiddler={{{ [[data/]addsuffix{!!id}] }}} index="name" /> If you like macro

[tw5] Re: Can I reference a data tiddler using a field value?

2020-01-18 Thread Mohammad
While Mat and Tony gave good solutions, I may recommend for learning dataTiddlers, read https://kookma.github.io/TW-Scripts/#datatiddler By the way a simple solution may be <$transclude tiddler={{{ [[data/]addsuffix{!!id}] }}} index="name" /> If you like macro and simple call to it then \def

[tw5] Re: Can I reference a data tiddler using a field value?

2020-01-18 Thread TonyM
Nice code Mat Another option is to use the transclude widget instead of the short forms, which are after all compact ways of transcluding. The transclude widget allows tiddler and field parameters and can be read without deciphering curly braces $parms$ etc.. Ie no concatenation is necessary.

[tw5] Re: Can I reference a data tiddler using a field value?

2020-01-18 Thread Mat
Come to think of it, here's a slimmer variant: \define fetch(attr, id:{{!!id}}) {{data/$id$##$attr$}} <> This uses a fallback for the id parameter so unless you include an id value in our call, it'll use !!id <:-) -- You received this message because you are subscribed to the Google Groups

[tw5] Re: Can I reference a data tiddler using a field value?

2020-01-18 Thread Mat
Correction: That should be $name=fetch (note the $ sign) <:-) -- 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 view thi

[tw5] Re: Can I reference a data tiddler using a field value?

2020-01-18 Thread Mat
> > \define fetch(attr) {{data/{{!!id}}##$attr$}} > First, note it is not possible to use nested "shortform syntax", i.e you must not {{...{{ }} ...}} Instead use explicit transclusion for the outer one. However, in this case you're also attempting to concatenate the id, which typically means

[tw5] Re: Can I reference a data tiddler using a field value?

2020-01-18 Thread amreus
Well, I'm not getting it. I can't seem to create a macro without explicitly passing the `id` field value. I would like to just do something like this: \define fetch(attr) {{products/{{!!id}}##$attr$}} ... Size: <> Is this explained more clearly somewhere? Thanks. -- You received this messa

[tw5] Re: Can I reference a data tiddler using a field value?

2020-01-18 Thread amreus
Excellent, thanks for the example! I realized I actually want something more general so that I can pass the data key as well. So this works: \define x(id, key) {{data/$id$##$key$}} Going to study up on macros... thank again. -- You received this message because you are subscribed to the Googl

[tw5] Re: Can I reference a data tiddler using a field value?

2020-01-18 Thread Mat
Sure, you could make a macro like so. \define x(id) {{data/$id$##name}} (put it either in the display tiddler or in a separate tiddler which then has to be tagged with $:/tags/Macro ) and then in the display tiddler, assuming you have an id field with value 28 (as you indicate in your example)