Tinderbox User-to-User Forum (for formal tech support please email: info@eastgate.com)
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi
Tinderbox Users >> Moving to Tinderbox 6 >> Displaying values of attributes
http://www.eastgate.com/Tinderbox/forum//YaBB.cgi?num=1428518700

Message started by Barbara Snyder on Apr 8th, 2015, 2:45pm

Title: Displaying values of attributes
Post by Barbara Snyder on Apr 8th, 2015, 2:45pm

Hi --

I've been going through the tbRef and have a couple questions.

1 - I modified one of the examples to find a way to list all key attributes for a note:

$KeyAttributes.each(x){ $Text=$Text +x+"\n" ; }

But how can I show the actual value of each key attribute, not just its name?

2 - Is there a way to do the same for all user attributes? (Not just key attributes.) Or for a particular category of system attributes?


Thanks -- Barbara


Title: Re: Displaying values of attributes
Post by Mark Anderson on Apr 8th, 2015, 3:06pm

$Text=;
$KeyAttributes.each(x){ $Text=$Text +x+": "+eval("$"+x)+"\n" ; }


The first line stops each firing of the rule adding another set of data to $Text. Do note that you'll get the default formatting of each value. This approach doesn't lend itself to trying to detect the attribute name/type and enforcing some more particular formatting of the value.

To do the same with other list of attributes, you'll first have to populate a list attribute with the names of the attributes. There is no action code method to read the names of attributes in the various system attribute groups or in user attributes.

Title: Re: Displaying values of attributes
Post by Barbara Snyder on Apr 8th, 2015, 4:10pm

Thanks! "eval" is obviously what I was looking for.

I wish there was a better way to find what I'm looking for when I don't know what it is!

Thanks -- Barbara


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.