Many thanks s.s, It is good to put the link to documentation wiki here! --Mohammad
On Monday, April 1, 2019 at 5:06:18 PM UTC+4:30, S. S. wrote: > > > I have copied and pasted from Eric's post - and added in some from > Jeremy's post, and a few of my own observations. > I am sure this is still not perfect. > > I hope this formats properly. Google Group's functionality and > reliability, and this posting editor must be one of the weakest links in > their formidable arsenal! > But then who are we to complain too loudly - free is not really free. > > > 1. If the "tiddler" attribute is present: > 1a. Get the text of the tiddler, or the value of the "emptyValue" > attribute *if the tiddler attribute value or tiddler text field is empty > or missing* > <$set name="myvar" tiddler="SomeTiddler" emptyValue="sometext"> > 1b. If the "subtiddler" attribute is present, get the text of the > subtiddler from the specified tiddler, or the value of the "emptyValue" > attribute if the tiddler or subtiddler is blank or missing or the > subtiddler text field is blank > <$set name="myvar" tiddler="SomeTiddler" subtiddler="SomeSubTiddler" > emptyValue="sometext"> > 1c. If the "field" attribute is present, get the value of that field, or > the value of the "emptyValue" attribute if the tiddler or field is blank or > missing > <$set name="myvar" tiddler="SomeTiddler" field="somefield" > emptyValue="sometext"> > 1d. If the "index" attribute is present, get the value of the specified > index, or the value of the "emptyValue" attribute if the tiddler or index > is blank or missing > <$set name="myvar" tiddler="SomeTiddler" index="somefield" > emptyValue="sometext"> > *1e.* If the "tiddler" attribute is present and blank and the filter is > present and blank, then return the emptyValue, or blank if there is no > emptyValue > <$set name="myvar" tiddler="" filter="[somefilter[]]" > emptyValue="sometext"> > *1f.* If the "tiddler" attribute is present and blank and the filter is > present and not blank, then return the entire filter result, & see below > for how select behaves with a filter > <$set name="myvar" tiddler="" filter="[somefilter[]]"> > *1g.* If the "tiddler" attribute is present and blank and the value > attribute is present and blank, then return the emptyValue, or blank if > there is no emptyValue > <$set name="myvar" tiddler="" value="" emptyValue="sometext"> > 1h. If the "tiddler" attribute is present and blank and the value > attribute is present and not blank, then return the value > <$set name="myvar" tiddler="" value="somevalue"> > > 2. If the "filter" attribute is present and not blank, it is evaluated and: > 2a. If there is a non blank filter result, return the entire filter > results using double square brackets quoting around any results that > include spaces > <$set name="myvar" filter="[somefilter[]]"> > 2b. If the "value" attribute is present, the filter's result is ignored > and the value of the "value" attribute (even if it is blank) is returned. > <$set name="myvar" filter="[somefilter[]]" value="somevalue"> > 2c. If there is a blank filter result and the "emptyValue" attribute is > present, return the value of the "emptyValue" attribute > <$set name="myvar" filter="[somefilter[]]" emptyValue="sometext"> > 2d. If the "value" attribute and the "emptyValue" attribute are present, > if there is a non blank filter result, return the value (*even if it is > empty*), or *if the filter result is empty*, return the emptyValue > <$set name="myvar" filter="[somefilter[]]" value="somevalue" > emptyValue="sometext"> > 2e. If both the "filter" attribute and the "select" attribute are present > and the "select" attribute is a valid number "N", return the "Nth" result > from the filter > <$set name="myvar" filter="[somefilter[]]" select="3"> > 2f. If both the "filter" attribute and the "select" attribute are present > and the "select" attribute is a blank, return the entire filter results > <$set name="myvar" filter="[somefilter[]]" select=""> > 2g. If both the "filter" attribute and the "select" attribute are present > and there is a non blank filter result and the "select" attribute is not a > valid number, a blank is returned even if there is an emptyValue > <$set name="myvar" filter="[somefilter[]]" select="1000" emptyValue="this > won't be returned"> > 2h. If both the "filter" attribute and the "select" attribute are present > and there is a blank filter result, if there is an emptyValue it is > returned, otherwise a blank is returned. > <$set name="myvar" filter="[someBadfilter[]]" select="1000" > emptyValue="this will be returned"> > > 3. If neither the "tiddler" or "filter" attributes are provided, return > the value of the "value" attribute, or the value of the "emptyValue" > attribute if the "value" attribute is blank or missing > <$set name="myvar" value="somevalue" emptyValue="sometext"> > > Note: This does not exactly describe the behaviour: in Jeremy's 2b. > >> *If the "value" attribute is present and the filter results are empty, >> return the value of the "emptyValue" attribute, if present, otherwise >> return a blank result* >> > Testting shows: If there is a value attribute & no emptyValue attribute, > the value is returned irrespective of the filter's result. > > > Thanks Jeremy for laying out the sequence and to Eric for providing the > actual examples! > > Note:- It is sometimes difficult to ascertain if the *filter* attribute > as used in the *$set* widget is actually empty. > It may be that a filter in a *$list* widget shows a given filter as > empty, but that does not necessarily mean the same filter used as a value > of the *filter* attribute in the *$set* widget will show empty. > > That is how this topic started off! See the 2nd post in the discussion to > see how it was solved. > > Cheers! > > -- 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/4824cd25-af59-43f4-981a-25ce613b1aff%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.

