Minimum Origin Version Required: Origin 8 SR0
The following example try to get the report tree associated with hierarchical worksheet and output the tree in LabTalk console in Code Builder.
void Worksheet_GetReportTree_ex() { Worksheet wks = Project.ActiveLayer(); //assume the hierarchical worksheet is active Tree trReport; if ( _get_wks_report_tree(wks, trReport) ) //if the active worksheet has report tree associated with it, output the tree { out_tree(trReport); } else out_str("There is no report tree associated with the active worksheet!"); return; } static bool _get_wks_report_tree(Worksheet& wks, TreeNode& trReport) { if ( !wks || !trReport ) return false; if ( !wks.GetReportTree(trReport, NULL, 0, GRT_TYPE_RESULTS, TRUE) ) //get the first report on worksheet return false; return true; }