<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=ConciseSpreadsheetDisplay</id>
	<title>ConciseSpreadsheetDisplay - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://rt-wiki.bestpractical.com/index.php?action=history&amp;feed=atom&amp;title=ConciseSpreadsheetDisplay"/>
	<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=ConciseSpreadsheetDisplay&amp;action=history"/>
	<updated>2026-08-21T21:46:48Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://rt-wiki.bestpractical.com/index.php?title=ConciseSpreadsheetDisplay&amp;diff=553&amp;oldid=prev</id>
		<title>Admin: 2 revisions imported</title>
		<link rel="alternate" type="text/html" href="https://rt-wiki.bestpractical.com/index.php?title=ConciseSpreadsheetDisplay&amp;diff=553&amp;oldid=prev"/>
		<updated>2016-04-06T20:03:26Z</updated>

		<summary type="html">&lt;p&gt;2 revisions imported&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;To customize the display of the Spreadsheet function, one option is to install the perl module via CPAN:&lt;br /&gt;
&lt;br /&gt;
 perl -MCPAN -e &amp;#039;install RT::View::ConciseSpreadsheet&amp;#039;&lt;br /&gt;
&lt;br /&gt;
It may also install some dependencies such as Text::CSV_XS.&lt;br /&gt;
&lt;br /&gt;
When prompted for location of your RT.pm, enter the path to your RT lib, such as /opt/rt3/lib. Restart apache.&lt;br /&gt;
&lt;br /&gt;
You should see a new link at the bottom of your search results that says Spreadsheet(Concise). This will download a .tsv spreadsheet of the search. Some customization of this file may be necessary:&lt;br /&gt;
&lt;br /&gt;
$RTHOME/share/html/[[ConciseSpreadsheet]]/Results.tsv:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;amp;lt;%INIT&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 use Text::CSV_XS;&lt;br /&gt;
 &lt;br /&gt;
 my $Tickets = RT::Tickets-&amp;amp;gt;new($session{&amp;#039;CurrentUser&amp;#039;});&lt;br /&gt;
 $Tickets-&amp;amp;gt;FromSQL($ARGS{&amp;#039;Query&amp;#039;});&lt;br /&gt;
 &lt;br /&gt;
 $Format ||= $RT::DefaultSearchResultFormat;&lt;br /&gt;
 # Scrub the html of the format string to remove any potential nasties.&lt;br /&gt;
 $Format = $m-&amp;amp;gt;comp(&amp;#039;/Elements/ScrubHTML&amp;#039;, Content =&amp;amp;gt; $Format);&lt;br /&gt;
 my (@Format) = $m-&amp;amp;gt;comp(&amp;#039;/Elements/CollectionAsTable/ParseFormat&amp;#039;, Format =&amp;amp;gt; $Format);&lt;br /&gt;
 &lt;br /&gt;
 $r-&amp;amp;gt;content_type(&amp;#039;application/vnd.ms-excel&amp;#039;);&lt;br /&gt;
 &lt;br /&gt;
 my @header=();&lt;br /&gt;
 &lt;br /&gt;
 # used to store m-&amp;amp;gt;comp output - prevents the output from being&lt;br /&gt;
 # written to the output stream. That&amp;#039;s because we are not interested in the&lt;br /&gt;
 # output for these comp() calls, we are interested in the return value.&lt;br /&gt;
 my $mason_output;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 foreach my $column (@Format) {&lt;br /&gt;
    next if ($column-&amp;amp;gt;{title} and $column-&amp;amp;gt;{title} eq &amp;#039;NEWLINE&amp;#039;);&lt;br /&gt;
    my $retro = undef ;&lt;br /&gt;
 &lt;br /&gt;
   # my $dump = Dumper($column);&lt;br /&gt;
   # $RT::Logger-&amp;amp;gt;debug(&amp;#039;my column dump is &amp;#039;.$dump);&lt;br /&gt;
 &lt;br /&gt;
    # Determine the column titles&lt;br /&gt;
    my $title = $column-&amp;amp;gt;{title};&lt;br /&gt;
 &lt;br /&gt;
    unless ($title) {&lt;br /&gt;
        $title = $column-&amp;amp;gt;{attribute};&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    $title =~ s/^__(.*)__$/$1/o if $title;&lt;br /&gt;
    if ($title and $title =~ /CustomField\.\{(.*)\}/) {&lt;br /&gt;
       $retro = $1;&lt;br /&gt;
    }&lt;br /&gt;
    my $ret = undef;&lt;br /&gt;
    $ret =&lt;br /&gt;
        $m-&amp;amp;gt;comp( { store =&amp;amp;gt; \$mason_output },&lt;br /&gt;
                        &amp;#039;/Elements/ColumnMap&amp;#039;,&lt;br /&gt;
                        Name =&amp;amp;gt; $title,&lt;br /&gt;
                        Attr =&amp;amp;gt; &amp;#039;title&amp;#039;&lt;br /&gt;
                        )&lt;br /&gt;
         ;&lt;br /&gt;
    $title = $ret ? $ret : $title;&lt;br /&gt;
    if ($title and $title =~ /^CODE\(/) {&lt;br /&gt;
    #   $RT::Logger-&amp;amp;gt;debug(&amp;#039;I need to use dumper on this &amp;#039;.$title);&lt;br /&gt;
       $title = $retro;&lt;br /&gt;
    }&lt;br /&gt;
    #$RT::Logger-&amp;amp;gt;debug(&amp;#039;cvs header is &amp;#039;.$title);&lt;br /&gt;
    push @header, $title;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 my $csv = Text::CSV_XS-&amp;amp;gt;new( { sep_char =&amp;amp;gt; &amp;quot;\t&amp;quot;, binary =&amp;amp;gt; 1, eol =&amp;amp;gt; &amp;quot;\012&amp;quot; } );&lt;br /&gt;
 &lt;br /&gt;
 $csv-&amp;amp;gt;combine(@header);&lt;br /&gt;
 $m-&amp;amp;gt;out( $csv-&amp;amp;gt;string() );&lt;br /&gt;
 while ( my $Ticket = $Tickets-&amp;amp;gt;Next()) {&lt;br /&gt;
    my @row;&lt;br /&gt;
    foreach my $column (@Format) {&lt;br /&gt;
        next if ($column-&amp;amp;gt;{title} and $column-&amp;amp;gt;{title} eq &amp;#039;NEWLINE&amp;#039;);&lt;br /&gt;
 &lt;br /&gt;
        my $column_value = &amp;#039;&amp;#039;;&lt;br /&gt;
 &lt;br /&gt;
        foreach my $subcol ( @{ $column-&amp;amp;gt;{output} } ) {&lt;br /&gt;
            if ( $subcol =~ /^__(.*?)__$/o ) {&lt;br /&gt;
                my $col = $1;&lt;br /&gt;
                my $value = $m-&amp;amp;gt;comp({ store =&amp;amp;gt; \$mason_output },&lt;br /&gt;
                                     &amp;#039;/Elements/ColumnMap&amp;#039;,&lt;br /&gt;
                                     Name =&amp;amp;gt; $col, Attr =&amp;amp;gt; &amp;#039;value&amp;#039;);&lt;br /&gt;
                if ( $value &amp;amp;amp;&amp;amp;amp; ref($value)) {&lt;br /&gt;
                    my @x = &amp;amp;amp;{ $value }( $Ticket, 0 );&lt;br /&gt;
                    $column_value .= join(&amp;#039;&amp;#039;, map { ref($_) ? $$_ : $_ } @x);&lt;br /&gt;
                } else {&lt;br /&gt;
                    $column_value .=  $value if($value); #we added if($value)&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
            else {&lt;br /&gt;
                $column_value .= $subcol;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
 &lt;br /&gt;
        $column_value =~ s{&amp;amp;lt;br(\s+/)?&amp;amp;gt;}{, }g;&lt;br /&gt;
        $column_value =  $scrubber-&amp;amp;gt;scrub( $column_value );&lt;br /&gt;
        $column_value =~ s{, $}{}g;    # ColumnMap is putting a trailing br&lt;br /&gt;
 &lt;br /&gt;
        push @row, $column_value;&lt;br /&gt;
    }&lt;br /&gt;
    $csv-&amp;amp;gt;combine(@row);&lt;br /&gt;
    $m-&amp;amp;gt;out( $csv-&amp;amp;gt;string() );&lt;br /&gt;
    $m-&amp;amp;gt;flush_buffer();&lt;br /&gt;
 }&lt;br /&gt;
 $m-&amp;amp;gt;abort();&lt;br /&gt;
 &amp;amp;lt;/%INIT&amp;amp;gt;&lt;br /&gt;
 &amp;amp;lt;%ARGS&amp;amp;gt;&lt;br /&gt;
 $Query =&amp;amp;gt; undef&lt;br /&gt;
 $Format =&amp;amp;gt; undef&lt;br /&gt;
 $HideResults =&amp;amp;gt; 0&lt;br /&gt;
 $Rows =&amp;amp;gt; 50&lt;br /&gt;
 $Page =&amp;amp;gt; 1&lt;br /&gt;
 $OrderBy =&amp;amp;gt; &amp;#039;id&amp;#039;&lt;br /&gt;
 $Order =&amp;amp;gt; &amp;#039;ASC&amp;#039;&lt;br /&gt;
 &amp;amp;lt;/%ARGS&amp;amp;gt;&lt;br /&gt;
 &amp;amp;lt;%once&amp;amp;gt;&lt;br /&gt;
 my $scrubber = HTML::Scrubber-&amp;amp;gt;new();&lt;br /&gt;
 $scrubber-&amp;amp;gt;deny(qw[*]);&lt;br /&gt;
 &amp;amp;lt;/%once&amp;amp;gt;&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>