get_report = { version = "1.0.4" # 2012-01-16 - GMF - 1.0.1 - Added code to copy -f or -df options from command line or URL to parameter, if variable resolution puts those values in command_line # 2012-04-16 - GMF - 1.0.2 - Added invalid_characters_regexp for filters # 2012-05-15 - GMF - 1.0.3 - Added invalid_characters_regexp for date_filter # 2012-05-20 - GMF - 1.0.4 - Fixed invalid_characters_regexp for date_filter and filter, which were reversed label = "Get Report" shortcut = "gr" requires_profile = true parameters = { # Cannot use report_name or -rn because it is already used in command_line! # Problem with duplicates looks to exist for required parameters only. # Note, as we cannot use the usual command_line node in get_xml_report() # we must simulate it by creating a new node and define all parameters # in the simulated_command_line node. # When specifying a new parameter then it has also to be specified # in the simulated_command_line. the_report_name = { shortcut = "r" required = true } sort_by = { shortcut = "sb" required = false } sort_direction = { shortcut = "sd" required = false } date_filter = { shortcut = "df" required = false invalid_characters_regexp = "[^-:/, a-zA-Z0-9]+" } filters = { shortcut = "f" required = false invalid_characters_regexp = "[^[:print:]]+" # Allows all visible characters including spaces } filters_comment = { shortcut = "fc" required = false } starting_row = { shortcut = "stro" required = false } ending_row = { shortcut = "er" required = false } filters_get_report = { shortcut = "fgr" required = false } } expression = ` #echo("date_filter: " . date_filter); include "templates.statistics.static_reports.get_xml_report"; #echo("command_line.filters: " . command_line.filters); string profile_name = internal.profile_name; string profile_label = @'profiles'{profile_name}{'label'}; # delete_node("v.simulated_command_line"); # v.simulated_command_line = ""; # Work around an issue in 8.5.3, where internal.filters overrides the parameter filters. By specifying # filters_get_report, this can manually set a filter value. This won't be necessary in 8.5.4. if (filters_get_report ne "(unspecified)") then ( # command_line.filters = filters_get_report; internal.filters = filters_get_report; ); #echo("looking up filters"); #echo("filters: " . filters); #echo("filters_get_report: " . filters_get_report); #echo("filters_comment: " . filters_comment); #echo("command_line.filters: " . command_line.filters); #echo("command_line.filters_comment: " . command_line.filters_comment); # If command_line.filter is specified, it means they used the f option in the URL or command line; copy it to the filter. if (command_line.filters ne "") then filters = command_line.filters; # If command_line.date_filter is specified, it means they used the df option in the URL or command line; copy it to the filter parameter. if (command_line.date_filter ne "") then date_filter = command_line.date_filter; # Create a parameters node for get_xml_report(), which # in fact simulates the command_line node. The subnode names # in the simulated_command_line must match the names as # in command_line.cfg. if (date_filter eq "(unspecified)") then date_filter = ""; if (filters eq "nofilters") then filters = ""; if (filters eq "(unspecified)") then filters = ""; if (sort_by eq "(unspecified)") then sort_by = ""; if (sort_direction eq "(unspecified)") then sort_direction = ""; if (filters_comment eq "(unspecified)") then filters_comment = ""; if (starting_row eq "(unspecified)") then starting_row = ""; if (ending_row eq "(unspecified)") then ending_row = ""; node simulated_command_line = new_node(); @simulated_command_line{"report_name"} = the_report_name; @simulated_command_line{"sort_by"} = sort_by; @simulated_command_line{"sort_direction"} = sort_direction; @simulated_command_line{"date_filter"} = date_filter; @simulated_command_line{"filters"} = filters; @simulated_command_line{"filters_comment"} = filters_comment; @simulated_command_line{"starting_row"} = starting_row; @simulated_command_line{"ending_row"} = ending_row; debug_message("#### get_report.cfg simulated_command_line:\n" . node_as_string(simulated_command_line) . "\n"); string xml_report = get_xml_report( profile_name, simulated_command_line ); # Return '\n'; '\n'; 'get_report\n'; '' . profile_name . '\n'; '' . profile_label . '\n'; xml_report; '\n'; ` # expression } # get_report