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
Entering line breaks or carriage returns into rule (Read 7660 times)
Lewis Ulman
Full Member
*
Offline



Posts: 6

Entering line breaks or carriage returns into rule
Mar 31st, 2009, 2:05pm
 
Is there any way to place a line break or carriage return into a rule like the following?:

$Text=collect(child,$Project+": "+$Text)

This rule instructs an agent to build its own text out of two attributes of its children, and I would like to place a carriage return or line break after each child's $Text. I have tried adding +\n and +\r (with and without quotation marks), but that doesn't seem to be the correct approach, and I can't find the answer in the Wiki, Forum, Cookbook, or User's Manual.

Thanks for any advice. I am sure I am missing something obvious  Smiley
Back to top
 
« Last Edit: Mar 31st, 2009, 2:06pm by Lewis Ulman »  
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Entering line breaks or carriage returns into rule
Reply #1 - Mar 31st, 2009, 2:54pm
 
Collect() creates set-type data, so we need to use format() to join the set values as desired:

$Text=format(collect(child,$Project+": "+$Text),"\n")

This should work. It looks like TB isn't handling the \n and \t escape sequences as expected.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Lewis Ulman
Full Member
*
Offline



Posts: 6

Re: Entering line breaks or carriage returns into rule
Reply #2 - Mar 31st, 2009, 3:04pm
 
Thanks, Mark. I had realized that "collect" was creating a set and tried to use the format operator to define the separator as a line break, but when that resulted in a blank text, I figured I was in over my head  Smiley. It is reassuring to know that TB isn't behaving as you expect it to; at least I feel better about my ability to follow the manual.
Looks like a bug, but I will try to tinker with the syntax.

Thanks again.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Entering line breaks or carriage returns into rule
Reply #3 - Mar 31st, 2009, 3:22pm
 
Page 261 of the v4.6 PDF manual states:
Quote:
In quoted string arguments here (as elsewhere), \" is converted to a quotation mark, \n to a carriage return, and \t to a tab.


I've also checked in case this was an export only usage (for \n, etc., that is) but I get litteral strings there too.

Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Lewis Ulman
Full Member
*
Offline



Posts: 6

Re: Entering line breaks or carriage returns into rule
Reply #4 - Apr 1st, 2009, 2:22pm
 
I took another shot at this problem, and I noticed that

Quote:
$Text=format(collect(child,$Project+": "+$Text),"\n")

This should work. It looks like TB isn't handling the \n and \t escape sequences as expected.


tells another tale as well. That syntax doesn't substitute another character (e.g., ",") for the default set separator, either.

Curiouser and curiouser
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Entering line breaks or carriage returns into rule
Reply #5 - Apr 1st, 2009, 5:28pm
 
My hunch is something got shaken up by the syntax changes (and thus internal parsing changes) in TB v4.6.  I've reported this issue separately to Eastgate so hopefully if it is a glitch, and not user syntax error, then it will doubtless get fixed.
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Lewis Ulman
Full Member
*
Offline



Posts: 6

Re: Entering line breaks or carriage returns into rule
Reply #6 - Apr 8th, 2009, 9:02am
 
A workaround:
I have managed to collect text from notes and write a container rule that separates text from each note with a carriage return using a two-step workaround/process.

First, I create a set attribute called MySet. Then, I assign that attribute the following value in a container rule:

$MySet=collect(child,$Project+": "+$Text)

Then, I assign the container's text the following value:

$Text=format($MySet,"
")

with the quoted string being a carriage return copied and pasted from a Tinderbox note.

For some reason,

$Text=format(collect(child,$Project+": "+$Text),"
")

does not work.
Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Entering line breaks or carriage returns into rule
Reply #7 - Apr 8th, 2009, 9:35am
 
This will be fixed in the next release, with support in format() for new line (\n) and tab (\t) escape codes, so no need to ask for this as a feature.
Back to top
 
« Last Edit: Apr 8th, 2009, 9:36am by Mark Anderson »  

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Pages: 1
Send Topic Print