Ok, look, ive got a problem here, when you see methods of a class or tables, you see the layers in which they are modified by right side of a method, but in any subnode methods of report, table etc, you cant see the layers, for example i modify report method ClassDeclaration in var or usr layer, and there’s no text (sys, var, usr) by it, so the problem is i cant get its source like:
a = TreeNode::findNode(@"\Report\Report name\Methods subnode\Method name").getNodeInLayer(UtilEntryLevel::usr or sys or var…);
this works with classes and tables, but doesnt with forms reports etc… so, what can i do about it ? or maybe report methods arent saved in different layers ignoring the one which you modify in ? there’s no way to get the source of a method from different layers like in classes ?
(p.s. buuuuut, the a.applObjectLayer() does show the topmost layer in which it was modified, but it doesnt fit the requirements of mine);
When you use the following code for a form or report method:
a = TreeNode::findNode(@"\Forms\CustTable\Methods\ClassDeclaration").getNodeInLayer(UtilEntryLevel::usr or sys or var…);
It will give an error: Error executing code: TreeNode object not initialized.
The reason for this is that the method getNodeInLayer retrieves a version of the tree node from a specified layer. Tables and classes are special cases in the sense that they may have sub nodes that are saved in different layers. But since the Form and Report methods or other subnodes are not stored seperately in layers so this method is not able to initialize a TreeNode object and hence such an error is thrown.
You will get this error with a class or table method also if that method doesn’t exist in the specified layer.
If you want to get the sourcecode of any modified method of a form or a report in the current layer (for ex. ClassDeclaration method of the CustTable form in the current usr layer) then you can get it simply by the following code:
a = TreeNode::findNode(@"\Forms\CustTable\Methods\ClassDeclaration");
The drawback is that this way you cannot get the source code of any modified form or report method if the modification is in some other layer which is not the current layer. While you can get the source code for a table or a class method in any specified layer, if it exists in that layer.
so it is impossible to get the source of a report/form method of not the current layer, but a different one which does exists ? dah, sucks then >.>;
Thats all. i figured out how to get it by myself…
I am too facing the same problem . Can you please let me know if yo ugot a solution and what approach did you take for this ?
Yeah, get the TreeNode itself (from the root) from the layer you need, and you can use TreeNodeTraverserSource as a workaround, its not too nice, but atleast its usable for this case, this way you can extract methods versions from specific layers.
Thanks for the reply.
I was trying to use same logic as compare tool to get this. Would it be possible for you to share your code please?