# ================================== # Subroutine get_startup_report_name # ================================== # Returns the report_name which is used on the startup page # and as default value on default_report_on_zoom. # We use the first report which is available in the reports menu subroutine(get_startup_report_name(string profile_name, bool generate_report_files), ( string startup_report_name; node menu_item; node reports_menu_node = "profiles." . profile_name . ".statistics.reports_menu"; string type; bool visible; bool default_report_name_ok = false; if (!generate_report_files) then ( string visible_node_name = "visible" ) else ( string visible_node_name = "visible_if_files"; ); node submenu_item; node reports_submenu_node; foreach menu_item reports_menu_node ( # Note, at the time when the profile is created its possible that the visible node does not exist, # in such a case set visible to true! if (subnode_exists(menu_item, visible_node_name)) then ( visible = node_value(subnode_by_name(menu_item, visible_node_name)); ) else ( visible = true; ); if (visible) then ( type = node_value(subnode_by_name(menu_item, "type")); if (type eq "group") then ( if (node_exists(menu_item . ".items") and (num_subnodes(menu_item . ".items") > 0)) then ( reports_submenu_node = menu_item . ".items"; foreach submenu_item reports_submenu_node ( if (subnode_exists(submenu_item, visible_node_name)) then ( visible = node_value(subnode_by_name(submenu_item, visible_node_name)); ) else ( visible = true; ); if (visible) then ( default_report_name_ok = true; startup_report_name = node_value(subnode_by_name(submenu_item, "view_name")); last; ); ); ); ) else ( default_report_name_ok = true; startup_report_name = node_value(subnode_by_name(menu_item, "view_name")); # debug_message("@@@@ got view : " . node_name(menu_item) . "\n"); ); if (default_report_name_ok) then ( last; ); ); # if visible ); debug_message("@@@@ got startup_report_name : " . startup_report_name . "\n"); startup_report_name; ));