Listing.html, # of tickets

I’ve tried to add a line to the header of
$RTPath/WebRT/html/Search/Listing.html so that it displays the number
of tickets resulting from the query:

<& /Elements/Header, Title => “Search Results: “.$session{‘tickets’}->Count().” Tickets”, Refresh => $session{‘tickets_refresh_interval’} &>

That yields “BLAH/RT: Search Results: X Tickets”. Which is great.

EXCEPT that it is only counting the tickets on the last search criteria
or something. I’m not exactly sure about that, but it’s the best I can
tell.

For example, let’s say that I run a search with the criteria being all
"Status = new" tickets. The results would be 1 ticket. And the header
would display: “BLAH/RT: Search Results: 1 Tickets”. Aside from the
whole singular/plural thing, that’s good.

However, if I add a criterion to that search, such as “Status = resolved”,
the query would yield 52 tickets. However, the header would display:
“BLAH/RT: Search Results: 51 Tickets”. So, it looks like it’s only
counting the last Limit.

I’m not entirely sure this is a bug exactly, I’m just wanting to know
if anyone has suggestions on how I might go about accumulating the
total number of tickets for a search.

Thanks,
Matt

I’ve tried to add a line to the header of
$RTPath/WebRT/html/Search/Listing.html so that it displays the number
of tickets resulting from the query:

<& /Elements/Header, Title => “Search Results: “.$session{‘tickets’}->Count().” Tickets”, Refresh => $session{‘tickets_refresh_interval’} &>

->Count essentially changes the SQL query from:

select field.field.field from (etc)

to
select count(id) from (etc)

If a Limit statement is applied (which is how the 50 per page stuff does),
count is faithfully reporting how many rows would be returned :wink:

I’m not entirely sure this is a bug exactly, I’m just wanting to know
if anyone has suggestions on how I might go about accumulating the
total number of tickets for a search.

Depending on your installation, I’d be rather careful (repeating rather
broad searches just to get a count on each new page is ugly), however
storing the total results in the %session, and checking that you haven’t
already gotten a total result for the current search would be nifty.

                         Bruce Campbell                            RIPE
               Systems/Network Engineer                             NCC
             www.ripe.net - PGP562C8B1B                      Operations