Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Agent, Actions, Rules & Automation >> Entering line breaks or carriage returns into rule
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1238522726

Message started by Lewis Ulman on Mar 31st, 2009, 2:05pm

Title: Entering line breaks or carriage returns into rule
Post by Lewis Ulman on 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  :)

Title: Re: Entering line breaks or carriage returns into rule
Post by Mark Anderson on 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.

Title: Re: Entering line breaks or carriage returns into rule
Post by Lewis Ulman on 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  :). 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.

Title: Re: Entering line breaks or carriage returns into rule
Post by Mark Anderson on 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.


Title: Re: Entering line breaks or carriage returns into rule
Post by Lewis Ulman on 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

Title: Re: Entering line breaks or carriage returns into rule
Post by Mark Anderson on 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.

Title: Re: Entering line breaks or carriage returns into rule
Post by Lewis Ulman on 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.

Title: Re: Entering line breaks or carriage returns into rule
Post by Mark Anderson on 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.

Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com) » Powered by YaBB 2.2.1!
YaBB © 2000-2008. All Rights Reserved.