Gossamer Forum
Home : Products : DBMan : Customization :

Number of Records Displayed

Quote Reply
Number of Records Displayed
I have been looking at this too long. I have put this sub in to print the search results to a page that can be printed by a user. It works, but only prints the number of lines limited by db_max_hits in config - which is 15.

I just want it to continue listing for all of the hits from the query. I have tried changing the $numhits to $db_total_hits but that does not work either. I get the first 15 rows of data and the rest are blank.

What am I overlooking?

Code:
##########################################################
## Print to Screen ##
##########################################################
sub html_printout {
my (@hits) = @_;
my ($numhits) = ($#hits+1) / ($#db_cols+1);

for (0 .. $numhits - 1) {
%rec = &array_to_hash($_, @hits);

# }
print qq|
<TABLE WIDTH="800" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">
<TR>
<TD WIDTH=5 VALIGN=TOP>
<P>
<a href="$long_url"><FONT Face="verdana,arial,helvetica" Size=1>$rec{'Item_No'}</a></TD>
<TD WIDTH=400 VALIGN=TOP>
<P><UL>
<FONT Face="verdana,arial,helvetica" Size=1 color="black">$rec{'Issue'}</TD>
<TD WIDTH=200 VALIGN=TOP>
<P>
<FONT Face="verdana,arial,helvetica" Size=1 color="black">Client:$rec{'Status'}</TD>
<TD WIDTH=200 VALIGN=TOP>
<P>
<FONT Face="verdana,arial,helvetica" Size=1 color="black">Vendor:$rec{'Vend_Status'}</TD>

</FONT></TR>
</TABLE>
|;
}
}
#
Quote Reply
Re: Number of Records Displayed In reply to
I did it this way:
Code:
sub html_printout {
$db_max_hits = 100;

rest of your code

|;}
$db_max_hits = 15;
}#


[This message has been edited by mart (edited February 26, 2000).]
Quote Reply
Re: Number of Records Displayed In reply to
I have this also in my .cfg:
Code:
if($in{'view_print'}) {
$db_max_hits = 100; }
else { $db_max_hits = 15; }
related to the link with '&view_print'.
Quote Reply
Re: Number of Records Displayed In reply to
Thanks, but all that happened was the number of blank rows increased.
Quote Reply
Re: Number of Records Displayed In reply to
Basically,
I have found that if I change mh=5000 in the http:// line that is run on the browser everything is ok.

Now, I don't know how to set the mh value for a temporary subroutine. I have changed the code to:
Code:
sub html_view_success {
# --------------------------------------------------------
# This page displays the results of a successful search.
# You can use the following variables when displaying your
# results:
#
# $numhits - the number of hits in this batch of results.
# $maxhits - the max number of hits displayed.
# $db_total_hits - the total number of hits.
# $db_next_hits - html for displaying the next set of results.
#

my (@hits) = @_;
if ($in{'printout'}) {
$mh = 5100;

&html_printout(@hits);
return;
}
my ($numhits) = ($#hits+1) / ($#db_cols+1);
my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits);
$in{'nh'} ? ($nh = $in{'nh'}) : ($nh = 1);

$page_title = "Search Results";
&html_page_top;

# Go through each hit and convert the array to hash and send to
# html_record for printing.
if (($db_total_hits == 1) &#0124; &#0124; ($maxhits == 1)) {
&html_record_long(&array_to_hash(0, @hits));
}
else {
print qq|<p><$font>Your search returned <b>$db_total_hits</b> matches.</font>|;
if ($db_next_hits) { print "<br><$font>Pages: $db_next_hits</font>"; }
$i = 1;
print "<table>";
for (0 .. $numhits - 1) {
print "<tr>";
&html_record (&array_to_hash($_, @hits));
print "</tr>";
++$i;
}
print "</table>";
if ($db_next_hits) { print "<br><$font>Pages: $db_next_hits</font>";}
}
&html_footer;
&html_page_bottom;

}
#
##########################################################
## Print to Screen ##
##########################################################
sub html_printout {
my (@hits) = @_;

my ($numhits) = ($#hits+1) / ($#db_cols+1);

for (0 .. $numhits - 1) {
%rec = &array_to_hash($_, @hits);

print qq|
<TABLE WIDTH="700" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">
<TR>
<TD WIDTH=5 VALIGN=TOP>
<P>
<a href="$long_url"><FONT Face="verdana,arial,helvetica" Size=1>$rec{'Item_No'}</a></TD>
<TD WIDTH=400 VALIGN=TOP>
<P><UL>
<FONT Face="verdana,arial,helvetica" Size=1 color="black">$rec{'Issue'}</TD>
<TD WIDTH=200 VALIGN=TOP>
<P>
<FONT Face="verdana,arial,helvetica" Size=1 color="black">Client:$rec{'Status'}</TD>
<TD WIDTH=200 VALIGN=TOP>
<P>
<FONT Face="verdana,arial,helvetica" Size=1 color="black">Vendor:$rec{'Vend_Status'}</TD>

</FONT></TR>
</TABLE>
|;
}
}
#


Still no luck...I have notices that the mh value remais at 15 in the http:// line on the browser.

Any thoughts appreciated.
Quote Reply
Re: Number of Records Displayed In reply to
I have another solution for you...Go to the following web page:

http://anthrotech.com/...=res&uid=default

See the select drop-down menu for Number of Hits Per Page?

If you want this type of option for your users, then simply add these codes in the sub-routine where you have the search form codes:

Code:
open (DB, "<$db_file_name") or &cgierr("unable to open db file: $db_file
_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
@lines = <DB>;
close DB;
$number_of_records = scalar(@lines);

at the top.

Then add the following codes for the drop-down menu:

Code:
<SELECT NAME="mh">
<OPTION VALUE="0">Choose one of the following:
<OPTION VALUE="10">10
<OPTION VALUE="25">25
<OPTION VALUE="100">100
<OPTION value="$number_of_records">All Records
</SELECT>

And I am sure you can figure out how to use the $number_of_records variable with your codes rather than a drop-down menu.

Best of luck!

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Number of Records Displayed In reply to
Thanks,

I'll give it a shot...was this in the threads already? I have been looking around a great deal.

dse
Quote Reply
Re: Number of Records Displayed In reply to
Yep...sure is. Carol (JPDeni) wrote the codes for me back in the Summer of 1999 in this forum.

Wink

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Number of Records Displayed In reply to
Hey...looks like it has me on the way to completion..Thanks

BTW..

The code is not completely clear to me. What reference book have you found most helpful for finding odds and ends of this nature?
Quote Reply
Re: Number of Records Displayed In reply to
Here are some good references:

Perl for Dummies
Perl 5 for Dummies

Also, any of the books written by O'Reilly are awesome....

www.ora.com

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums