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
Conditional date expressions in export (Read 3283 times)
Rónán Kennedy
Full Member
*
Offline



Posts: 26

Conditional date expressions in export
Oct 24th, 2010, 3:17am
 
Again forgive me if this is covered elsewhere, and I may be doing something basic wrong, but I am trying to figure out how to conditionally include text when exporting to something other than HTML.

What I am trying to do is to have some text appear in the exported file if this condition is true:

Code:
days(today,$DueDate)<0 



However, the days export function works differently to the agent function, and checks whether a date is within N days of another date. It doesn't seem straightforward to check is something is overdue. I've tried:

Code:
^if(^days(^get($DueDate)^,-100)^)^(overdue)^endif^ 



but this doesn't work, at least for me.

Any pointers appreciated.

Thanks,

Rónán
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Conditional date expressions in export
Reply #1 - Oct 24th, 2010, 4:59am
 
If you want the internal method of days(), use:

  ^if(^value(days(today,$DueDate)<0)^)^.......

In other words, use your action code expression inside a ^value()^ tag. One other thing if using the above method, make sure to do comparison in the action code rather than try to use value to create a value to test against zero or whatever.  for reasons I don't fully understand that doesn't work. So don't write the above like so, I've highlighted the transposed bit of code:

  ^if(^value(days(today,$DueDate))^<0)^....... <-- WRONG

One other 'gotcha'. The action code days() takes into account the time element of the date time. so if it is 13:00 now, days() for a date/time of 11:00 tomorrow will be zero and not 1 as you might expect. (FWIW, I've already made a feature suggestion that days() have an optional third Boolean parameter which if set as true would tell TB to use only date and ignore time in the comparison.)
Back to top
 
« Last Edit: Oct 24th, 2010, 5:17am by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Rónán Kennedy
Full Member
*
Offline



Posts: 26

Re: Conditional date expressions in export
Reply #2 - Oct 24th, 2010, 5:52am
 
That works very well, thanks.
Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print