# # # # create_report_job_util.cfv # # # # # # # get_number_of_date_filters_in_report_elements() # # # subroutine(get_number_of_date_filters_in_report_elements( node report_elements), ( int number_of_date_filters = 0; node item; foreach item report_elements ( if (?(item . ".date_filter.df") and (@(item . ".date_filter.df") ne "")) then ( number_of_date_filters++; ); ); number_of_date_filters; )); # # # # get_calendar_first_weekday_or_marked_weekday() # # # #subroutine(get_calendar_first_weekday_or_marked_weekday( # node misc_options, # string first_or_marked_weekday_node_name), ( # # # Note, we use first_weekday and marked_weekday of statistics_misc only if they contain a value, # # else we use the default lang_stats value! # # int first_or_marked_weekday; # # if (misc_options?{first_or_marked_weekday_node_name} and (@misc_options{first_or_marked_weekday_node_name} ne "")) then ( # # # Override default with profile specific value # first_or_marked_weekday = @misc_options{first_or_marked_weekday_node_name}; # ) # else if (?("lang_stats." . first_or_marked_weekday_node_name)) then ( # # # Use lang_stats default value # first_or_marked_weekday = @("lang_stats." . first_or_marked_weekday_node_name); # ) # else ( # first_or_marked_weekday = 1; # ); # # # Fix older profiles where first_weekday or marked_weekday contains a 0 value. # # The 0 value must be converted to 1 # # if (first_or_marked_weekday == 0) then (first_or_marked_weekday = 1); # # first_or_marked_weekday; #)); # # # # get_omit_parenthesized_items_table_filter_expression() # # # # KHP 18/Jan/2012 - Moving omit_parenthesized_items handling again to report filters # because of performance problems when using a table filter expression. #subroutine(get_omit_parenthesized_items_table_filter_expression( # string session_id, # bool is_root_admin, # string profile_name, # node report_element), ( # # # Creates a hard coded table_filter_expression to omit parenthesized_items in a table. # # The expression should omit items if each non-aggregating field contains a parenthesized item. # # # I.e.: # # table_filter_expression = "!matches_regular_expression(cell_by_name('" . report_field_name . "'), '^[(].*[)]$')"; # # # node query_fields = get_query_fields(session_id, is_root_admin, profile_name); # # string expression; # # # # # Find relevant report fields and add them to expression # # # # if (report_element?{"columns"}) then ( # # node column; # node report_element_columns = report_element{"columns"}; # string report_field_name; # string report_field_name_in_expression; # node query_field_item; # # foreach column report_element_columns ( # # report_field_name = @column{"report_field"}; # query_field_item = query_fields{report_field_name}; # # if (!@query_field_item{"is_aggregating_field"} and !@query_field_item{"is_expression"}) then ( # # # Add report field to expression # expression .= "(!matches_regular_expression(cell_by_name('" . report_field_name . "'), '^[(].*[)]$')) and "; # ); # ); # ); # # if (expression ne "") then ( # # # Remove last " and " statement # expression = replace_last(expression, " and ", ""); # ); # # expression; #)); # # # # get_pivot_table_omit_parenthesized_items_table_filter_expression() # # # # KHP 18/Jan/2012 - Moving omit_parenthesized_items handling again to report filter # because of performance problems when using a table filter expression. #subroutine(get_pivot_table_omit_parenthesized_items_table_filter_expression( # string session_id, # bool is_root_admin, # string profile_name, # node report_element), ( # # # Creates a hard coded table filter sub-expression to omit parenthesized_items for the pivot table field # # # I.e.: # # table_filter_expression = "!matches_regular_expression(cell_by_name('" . report_field_name . "'), '^[(].*[)]$')"; # # node query_fields = get_query_fields(session_id, is_root_admin, profile_name); # # string expression; # # node pivot_table = report_element{"pivot_table"}; # string report_field_name = @pivot_table{"report_field"}; # # # if (query_fields?{report_field_name} and # !@query_fields{report_field_name}{"is_expression"}) then ( # # expression = "(!matches_regular_expression(cell_by_name('" . report_field_name . "'), '^[(].*[)]$'))"; # ); # # expression; #)); # # # # get_updated_table_filter_expression() # # # # KHP 18/Jan/2012 - Moving omit_parenthesized_items handling again to report filter # because of performance problems when using a table filter expression. #subroutine(get_updated_table_filter_expression( # string session_id, # bool is_root_admin, # string profile_name, # node report_element), ( # # # This returns the existing table_filter expression, respectively # # a modified expression if omit_parenthesized_items is active. # # string table_filter_expression = @report_element{"table_filter_expression"}; # string subexpression; # # if (@report_element{"omit_parenthesized_items"}) then ( # # subexpression = get_omit_parenthesized_items_table_filter_expression( # session_id, # is_root_admin, # profile_name, # report_element # ); # # if (table_filter_expression ne "") then ( # table_filter_expression = '(' . table_filter_expression . ') and ' . subexpression; # ) # else ( # table_filter_expression = subexpression; # ); # ); # # # # # Check omit parenthesized items in pivot table # # # # if (?(report_element . ".pivot_table.show_pivot_table") and # @(report_element . ".pivot_table.show_pivot_table") and # ?(report_element . ".pivot_table.omit_parenthesized_items") and # @(report_element . ".pivot_table.omit_parenthesized_items")) then ( # # subexpression = get_pivot_table_omit_parenthesized_items_table_filter_expression( # session_id, # is_root_admin, # profile_name, # report_element # ); # # if (table_filter_expression ne "") then ( # table_filter_expression = '(' . table_filter_expression . ') and ' . subexpression; # ) # else ( # table_filter_expression = subexpression; # ); # ); # # # Return # table_filter_expression; #));