Page 1 of 1

Setting and Retrieving Custom Properties within rTree

Posted: Sat Mar 22, 2014 10:30 pm
by Mike Doub
I am creating an rTree from an array. This array includes some custom properties. When I look at the nodeData after creating the rTree, I do in fact see the custom properties, however I am not able to retrieve them using the custom syntax:

put the accountID_of_node_ID_[email_id] of control "inbox"

Interestingly enough when I use this syntax to set the variable I am able to retrieve it:

set the accountID_of_node_ID_[email_id] of control "inbox" to 99
put the accountID_of_node_ID_[email_id] of control "inbox"

Can you explain how these user created properties work or point me to an area within the rTree code? I am unable to find the code that would be relevant. There is a lot of code here :-). Why would I not be able to retrieve a custom property that was created in an array?

Regards,
Mike

Re: Setting and Retrieving Custom Properties within rTree

Posted: Mon Mar 24, 2014 2:52 pm
by wilstrand
Hi Mike!

What you are doing when you set a custom property with your:

Code: Select all

the accountID_of_node_ID_[email_id] of control "inbox" to 99
is that you actually creates a customPropertySet with the name:
"accountID_of_node_ID_"
You should see it in your Property Inspector.

You can of course then get the value of your custom property with:

Code: Select all

put the accountID_of_node_ID_[email_id] of control "inbox"
But note that this custom property will not get into the Tree array!

If you on the other hand put your custom property data into the Tree array in the first place
there are two ways you can retrieve that data:
Either get the array from the Tree into a variable and work with that:

Code: Select all

put the nodeData of control "inbox" into tNodeDataA
return tNodeDataA[email_id][accountID]
or use a getProp handler in your control script to work with the customPropertySet syntax:

Code: Select all

getProp accountID_of_node_ID_[tID]
   put the nodeData of control "inbox" into tNodeDataA
   return tNodeDataA[tID]["accountID"]
end accountID_of_node_ID_
Hope this explains it!

Best regards
Mats