Hi S.S.,

I just got the chance to test out your code. I had to massage it just a 
smidge, but it works great! Thank you. I have bashed my head against this 
problem for too long. I'm always amazed at how concise well-written 
tiddlywiki code can be. The solution to my problems is often achieved in 
half the code I thought would be required. 

Thank you everybody!

Best wishes,
Adam

On Wednesday, February 13, 2019 at 1:28:04 PM UTC, S. S. wrote:
>
> Adam, not sure if this is what you want.
>
> In tiddler : NewTiddler
> \define concatStateTiddler(value)
> <$list filter="[all[current]get[draft.of]] [all[current]!has[draft.of]] 
> +[addprefix[$:/state/]]">
> <$view field=backup-$value$/>
> </$list>
> \end
>
> In tiddler: 
> *$:/state/NewTiddler*has field: *backup-1*
> field backup-1 has value : *somevalue*
>
> When *NewTiddler* is being viewed or edited, this macro in its text field 
> *<<concatStateTiddler 
> 1>>*  should give a result of : *somevalue*
>
>
> On Wednesday, February 13, 2019 at 7:58:14 AM UTC+7, admls wrote:
>>
>> Hi Folks,
>>
>> I'm trying to populate a stylesheet, but I'm having trouble getting these 
>> macros to work together. The concatStateTiddler macro is supposed to give 
>> me the name of a state tiddler tacked composed of a prefix and the name of 
>> the currentTiddler. The backup macro is supposed to fetch some value from 
>> the state tiddler if it is present. And if it is not present, it should 
>> fetch it from a set of backup values.
>>
>> \define concatStateTiddler()
>> <$set filter="[all[current]get[draft.of]] [all[current]!has[draft.of]]">
>> "$:/state/<<currentTiddler>>"
>> </$set>
>> \end
>>
>> \define backup(value)
>> <$view tiddler=$(concatStateTiddler)$ field="""$value$""">
>>  <$view tiddler="$:/config/backup-values" field="""backup-$value$""">
>>     </$view>
>> </$view>
>> \end
>>
>> I can get it to work if concatStateTiddler looks like this:
>> \define concatStateTiddler()
>> "$:/state/$(currentTiddler)$"
>> \end
>>
>> But I want the view and edit mode versions of the tiddler to use the same 
>> state tiddler. Hence the first version of concatStateTiddler. But the first 
>> version doesn't play nice with the backup macro. Any ideas of what I'm 
>> doing wrong here?
>>
>> The only thing I can think is that the set widget is creating a list, 
>> even if it is a list consisting of only one element (on account of the use 
>> of [all[current]]). That list format may be playing havoc with the backup 
>> macro. But I really don't have any idea beyond that. Any help would be 
>> greatly appreciated.
>>
>> Best regards,
>>
>> Adam
>>
>

-- 
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 post to this group, send email to [email protected].
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/e7b4d9b9-acf6-453b-99d7-24f1229c0a53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to