Hi Matabele

Thank you very much :-)

I don't quite understand how to use the "myVariable" bit? - or get the idea 
behind "emptyValue" as opposed to writing: 
filter="[all[current]field:gender[]]" 
value="Missing value for gender"?  - therefore I had to create a very long 
tiddler to get 12 simple macros:

Tiddler name: Macros for he_she_He_She_him_her_Him_Her_his_her_His_Her

\define he()
<$set name="myVariable" filter="[all[current]field:gender[male]]" value="he" 
emptyValue="">
<$text text=<<myVariable>>/>
<$set name="myVariable" filter="[all[current]field:gender[female]]" value="she" 
emptyValue="">
<$text text=<<myVariable>>/>
<$set name="myVariable" filter="[all[current]field:gender[]]" value="Missing 
value for gender" emptyValue="">
<$text text=<<myVariable>>/>
</$set>
</$set>
</$set>
\end
\define He()
<$set name="myVariable" filter="[all[current]field:gender[male]]" value="He" 
emptyValue="">
<$text text=<<myVariable>>/>
<$set name="myVariable" filter="[all[current]field:gender[female]]" value="She" 
emptyValue="">
<$text text=<<myVariable>>/>
</$set>
</$set>
\end
\define she()
<$set name="myVariable" filter="[all[current]field:gender[male]]" value="he" 
emptyValue="">
<$text text=<<myVariable>>/>
<$set name="myVariable" filter="[all[current]field:gender[female]]" value="she" 
emptyValue="">
<$text text=<<myVariable>>/>
</$set>
</$set>
\end
\define Hun()
<$set name="myVariable" filter="[all[current]field:gender[male]]" value="He" 
emptyValue="">
<$text text=<<myVariable>>/>
<$set name="myVariable" filter="[all[current]field:gender[female]]" value="She" 
emptyValue="">
<$text text=<<myVariable>>/>
</$set>
</$set>
\end

\define him()
<$set name="myVariable" filter="[all[current]field:gender[male]]" value="him" 
emptyValue="">
<$text text=<<myVariable>>/>
<$set name="myVariable" filter="[all[current]field:gender[female]]" value="her" 
emptyValue="">
<$text text=<<myVariable>>/>
</$set>
</$set>
\end
\define Him()
<$set name="myVariable" filter="[all[current]field:gender[male]]" value="Him" 
emptyValue="">
<$text text=<<myVariable>>/>
<$set name="myVariable" filter="[all[current]field:gender[female]]" value="Her" 
emptyValue="">
<$text text=<<myVariable>>/>
</$set>
</$set>
\end
\define her()
<$set name="myVariable" filter="[all[current]field:gender[male]]" value="him" 
emptyValue="">
<$text text=<<myVariable>>/>
<$set name="myVariable" filter="[all[current]field:gender[female]]" value="her" 
emptyValue="">
<$text text=<<myVariable>>/>
</$set>
</$set>
\end
\define Her()
<$set name="myVariable" filter="[all[current]field:gender[male]]" value="Him" 
emptyValue="">
<$text text=<<myVariable>>/>
<$set name="myVariable" filter="[all[current]field:gender[female]]" value="Her" 
emptyValue="">
<$text text=<<myVariable>>/>
</$set>
</$set>
\end

\define his()
<$set name="myVariable" filter="[all[current]field:gender[male]]" value="his" 
emptyValue="">
<$text text=<<myVariable>>/>
<$set name="myVariable" filter="[all[current]field:gender[female]]" value="her" 
emptyValue="">
<$text text=<<myVariable>>/>
</$set>
</$set>
\end
\define His()
<$set name="myVariable" filter="[all[current]field:gender[male]]" value="His" 
emptyValue="">
<$text text=<<myVariable>>/>
<$set name="myVariable" filter="[all[current]field:gender[female]]" value="Her" 
emptyValue="">
<$text text=<<myVariable>>/>
</$set>
</$set>
\end
\define her()
<$set name="myVariable" filter="[all[current]field:gender[male]]" value="his" 
emptyValue="">
<$text text=<<myVariable>>/>
<$set name="myVariable" filter="[all[current]field:gender[female]]" value="her" 
emptyValue="">
<$text text=<<myVariable>>/>
</$set>
</$set>
\end
\define His()
<$set name="myVariable" filter="[all[current]field:gender[male]]" value="His" 
emptyValue="">
<$text text=<<myVariable>>/>
<$set name="myVariable" filter="[all[current]field:gender[female]]" value="Her" 
emptyValue="">
<$text text=<<myVariable>>/>
</$set>
</$set>
\end

{{||FakeRadio}}
<<he>>
<<She>>
<<his>>


"FakeRadio" tiddler:


<$reveal type="match" state="!!gender" text="">
<$button set="!!gender" setTo="male" class='tc-btn-invisible'>
<input type=radio/></$button>  Choose Boy/girl/pige</$reveal>
<$reveal type="match" state="!!gender" text="female">
<$button set="!!gender" setTo="" class='tc-btn-invisible'>
<input type=radio checked/></$button>  Girl</$reveal>

<$reveal type="match" state="!!gender" text="male">
<$button set="!!gender" setTo="female" class='tc-btn-invisible'>
<input type=radio checked/></$button>  Boy</$reveal><$reveal type="match" 
state="!!gender" text="">

<$button set="!!gender" setTo="male" class='tc-btn-invisible'>
<input type=radio/></$button>  Choose Boy/girl</$reveal>
<$reveal type="match" state="!!gender" text="female">
<$button set="!!gender" setTo="" class='tc-btn-invisible'>
<input type=radio checked/></$button>  Girl</$reveal>

<$reveal type="match" state="!!gender" text="male">
<$button set="!!gender" setTo="female" class='tc-btn-invisible'>
<input type=radio checked/></$button>  Boy</$reveal>

I guess there must be a more simple way to do this - if you understand 
<<myVariable>> and how to exploit the value variations?

Cheers Måns Mårtensson


Den lørdag den 11. juni 2016 kl. 20.16.02 UTC+2 skrev Matabele:
>
> Hi Mans
>
> This kind of conditional can be fairly simply achieved using the SetWidget 
> -- the widget will choose either a 'value' or an 'emptyValue' depending 
> upon the output of the filter expression.
>
> <$set name="myVariable" filter="[all[current]field:gender[male]]" value="It's 
> male" emptyValue="It's not male">
> <$text text=<<myVariable>>/>
> </$set>
>
>
> regards
>
> On Friday, 10 June 2016 21:50:25 UTC+2, Måns wrote:
>>
>> Hi TwWizards
>>
>> I have a radio button which sets a value of a field "gender" to either 
>> "male" or "female".
>>
>> Now I want to create 4 or 5 macros which will show/wikify the value as 
>> different results.
>>
>> I guess some kind of "if evaluation" is needed?
>>  
>> Macro 1 should show male as "he" and female as "she" I think it should 
>> look like this <<he>> or <<she>>
>> Macro 1b should show male as "He" and female as "She" <<He>> <<She>>
>>
>> Macro 2 should show male as "him" and female as "her"  <<him>> <<her>> 
>> Macro 2b should show male as "Him" and female as "Her" <<Him>> <<Her>>
>>
>> I guess creating  macros like this is a better and more simple way to 
>> achieve what I described in this post 
>> <https://groups.google.com/d/topic/tiddlywiki/XlkKA4WDbDo/discussion>.
>>
>> Cheers Måns Mårtensson 
>>
>

-- 
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/474d9be9-7cad-4c28-b5da-18fa6b4ffece%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to