[tw] Re: fET output issue - tiddler.titles

2013-01-29 Thread AlanBCohen
Thanks a LOT!! I used the info you supplied (great explanation!) to
make the following version. I expanded the concept slightly when I saw
the first set of results to display the DateTimestamps as tiddler
links.
The workunit version:
<><>
The Date Summary version (which also has the tag 'status'; note the
exclusion to prevent recursion):
<><>

-- 
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 http://groups.google.com/group/tiddlywiki?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




[tw] Re: fET output issue - tiddler.titles

2013-01-29 Thread Eric Shulman
> ... The issue is the tiddler.title is being
> formatted as 'NaN' (as a missing wikiword) instead of displaying
...
> write '+tiddler.title+" - "+tiddler.text+"\n"'>>


The clauses of fET are actually snippets of javascript code.

In javascript, the "+" operator can be used either to join text
strings together (concatenation) or to calculate numeric values
(addition).  Javascript also permits *mixed* expressions that combine
text strings and numeric values, implicitly recasting text strings
into numbers, or numbers into text, depending upon the type of the
initial variable in the expression; i.e., if an expression starts with
text, the remainder of the expression is recast as text; if the
expression starts with a number, the remainder of the expression is
recast as a number as well.

Thus, if the first variable is text:
   "abc"+1 => abc1
   "123"+1 => 1231
while, if the first variable is numeric:
1+"123" => 124
1+"abc" => 1

Note that in the last example above, "abc" contains no numeric
characters and, for most browser engines, has an implied value of 0
(zero).  However, some browsers (IE in particular) convert non-numeric
text (i.e., "abc") into a special numeric value, NaN ("Not a
Number").  Numeric expressions containing a NaN value always produce a
NaN value as a result.  Thus, in the last expression above, instead
of
1+"abc" => 1+0  => 1
you get
1+"abc" => 1+NaN => NaN

It's also important to note that if the expression starts with a text
string, you can FORCE that text to be recast as a number by using a
leading "+" operator, like this:
   +"123"+1
The result is that "123" is recast as 123 and, instead of a text
result
"123"+1 => "1231"
you get a numeric result
   +"123"+1 => 123 + 1   => 124

If the initial text string is non-numeric (e.g., "abc") then, for most
browsers, +"abc" has a 0 numeric value:
+"abc"+1  => 0+1 => 1
but, as noted above, IE will recast +"abc" as a NaN value:
+"abc"+1  => NaN+1 => NaN

Putting it all together: in your use case, the write clause you've
used produces code output like this:
   +tiddler.title+" - "+tiddler.text+"\n"

However, the leading "+" in the write clause forces the tiddler.title
variable to be recast as a number, which gives a NaN value in IE, as
you are seeing.

SOLUTION: Try removing the first "+" from the write clause:
   write 'tiddler.title+" - "+tiddler.text+"\n"'>>

Let me know how it works out

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...
   http://www.TiddlyTools.com/#Donations

Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:
   http://www.TiddlyTools.com/#Contact

-- 
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 http://groups.google.com/group/tiddlywiki?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.