Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Interpreting a string as math (make it stop!) (Read 2996 times)
bobby saha
Full Member
*
Offline



Posts: 2

Interpreting a string as math (make it stop!)
Jun 01st, 2013, 1:22pm
 
Hi There-

I have a string at the beginning of a note that happens to be in this format: 2013-06-01.

I want that to be used as a HoverExpression, but when I use an action to retrieve this part of the note, Tinderbox is calculating the value of that string as if it was meant to be a math problem.  

In other words, instead of putting "2013-06-01" as HoverExpression, it is showing up as "2006", which is technically correct but not what I want.

Here's the action I was using that is getting me this value:

HoverExpression=$Text.substr(0,10) (I want to take the first 10 characters of the note and use that  as the HoverExpression).

How can I get Tinderbox to NOT interpret that? I want the string to be left alone.

Thanks! Cheesy
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Interpreting a string as math (make it stop!)
Reply #1 - Jun 1st, 2013, 1:58pm
 
Ah, likely you're using a rule or stamp like this:

$HoverExpression = $Text.substr(0,10)

Unwittingly, you're telling to TB you make the $HoverExpression the evaluated result of $Text.substr(0,10). The latter returns "2013-06-01" which , in effect TB see as a sum and evaluates. Remember that like $DisplayExpression, $HoverExpression store a string [sic] of the code you wish evaluated.

To set such an attribute via code, you must pass the whole expression as a quoted string, i.e.:

$HoverExpression = "$Text.substr(0,10)"

If your expression already uses (double) quotes, enclose the whole expression in single quotes.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Mark Bernstein
YaBB Administrator
*
Offline

designer of
Tinderbox

Posts: 2871
Eastgate Systems, Inc.
Re: Interpreting a string as math (make it stop!)
Reply #2 - Jun 1st, 2013, 9:02pm
 
What are the odds of getting two questions about static vs dynamic evaluation of DisplayExpressions within a few hours of each other?

The world works in mysterious ways.
Back to top
 
 
WWW   IP Logged
bobby saha
Full Member
*
Offline



Posts: 2

Re: Interpreting a string as math (make it stop!)
Reply #3 - Jun 3rd, 2013, 9:58am
 
Ah, excellent, that did the trick.

Thanks!
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print