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
Displaying values of attributes (Read 1364 times)
Barbara Snyder
Full Member
*
Offline



Posts: 80

Displaying values of attributes
Apr 08th, 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

Back to top
 
 
  IP Logged
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Re: Displaying values of attributes
Reply #1 - 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.
Back to top
 
« Last Edit: Apr 8th, 2015, 3:07pm by Mark Anderson »  

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



Posts: 80

Re: Displaying values of attributes
Reply #2 - 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

Back to top
 
 
  IP Logged
Pages: 1
Send Topic Print