Just a guess
Will_Toth wrote:I am trying to create a simple tree data structure using DRVs. I created a typedef cluster with the following elements:
Int (node's data)
Array of this typedef cluster (child nodes)
My plan here is to save the head node, and be able to iterate through the tree via the child node array. However I cannot dynamically build and assign an array of nodes, I can only add a static array. The following image shows the error that I get.
Any ideas why this would give me an error?
Thanks
That .. looks recursive to me. Can you post the actual code? I'm suspicious that the DVR type is of a cluster without the same DVR in it (hence the error - DVR types are only compatible if they point to the exact same types of data).
EDIT: I think the problem lies in your first paragraph (formatting is mine):
I am trying to create a simple tree data structure using DRVs. I created a typedef cluster with the following elements:
Int (node's data)
Array of this typedef cluster (child nodes)
What you are saying is that the control contains instances of itself (via the DVR). This is not permitted - you end up with recursion and Controls do not support this directly. I think what you actually have there is a different cluster then you think you do - using the Context Help check the DVR contained type and make sure the DVR is the type you expect.
You could implement this by effectively by-passing LabVIEW's check by storing the DVR as a Variant instead (via the To Variant primitive). Variants can be effectively null. Or, if you don't mind using classes, you can use the approach listed here: