# # # add_raw_header() # # # This header describes the columns as they actually exist in the html table rows, including percent columns # and bar graph columns. # Note, the rows data header will be required to lookup zoom fields! In general, a user zooms per row, # so all relevant string fields/columns per row are zoom field candidates. subroutine(add_raw_header( node base_query_header, node raw_header, string main_report_field_name, string pivot_report_field_name, bool is_hierarchical_table, bool is_inner_table), ( debug_message("\n\n#### add_raw_header() \n\n"); debug_message("\n\n" . node_as_string(base_query_header) . "\n\n"); debug_message("#### is_hierarchical_table: " . is_hierarchical_table . "\n"); subroutine(add_data_column( node raw_header, int column_count, string report_field_name, string column_type, string category, bool skip_escaping), ( set_subnode_value(raw_header, column_count, ""); node new_column_node = raw_header{column_count}; set_subnode_value(new_column_node, "report_field_name", report_field_name); set_subnode_value(new_column_node, "column_type", column_type); set_subnode_value(new_column_node, "category", category); set_subnode_value(new_column_node, "skip_escaping", skip_escaping); )); node column; bool is_relevant_column; int ssql_column_number; string report_field_name; string column_type; # column_type is: index | text | breakdown | number | percent | bar_graph string category; # We require the category to check if a text column is of type page if show_http_link is enabled. bool is_aggregating_field; bool show_column; bool show_percent_column; bool show_bar_column; bool skip_escaping; int column_count = 0; # # Add the index column # add_data_column( raw_header, column_count, "", "index", "", false ); column_count = 1; foreach column base_query_header ( is_aggregating_field = @column{"is_aggregating_field"}; report_field_name = @column{"report_field_name"}; is_relevant_column = true; if (is_inner_table) then ( # Ignore any non-aggregating field, except the pivot table report field for the inner table! # So we ignore any non-aggregating field in the inner table other than the pivot report field if (!is_aggregating_field and (report_field_name ne pivot_report_field_name)) then ( is_relevant_column = false; ); ); if (is_relevant_column) then ( ssql_column_number = node_name(column); # display_format_type = @column{"display_format_type"}; show_column = @column{"show_column"}; if (is_aggregating_field) then ( column_type = "number"; show_percent_column = @column{"show_percent_column"}; show_bar_column = @column{"show_bar_column"}; ) else ( show_percent_column = false; show_bar_column = false; if (is_hierarchical_table and (report_field_name eq main_report_field_name)) then ( column_type = "breakdown"; ) else ( column_type = "text"; ) ); if (show_column) then ( category = @column{"category"}; skip_escaping = @column{"skip_escaping"}; add_data_column( raw_header, column_count, report_field_name, column_type, category, skip_escaping ); column_count++; ); if (show_percent_column) then ( add_data_column( raw_header, column_count, report_field_name, "percent", "", false ); column_count++; ); if (show_bar_column) then ( add_data_column( raw_header, column_count, report_field_name, "bar_graph", "", false ); column_count++; ); ); ); # foreach column ));