Gossamer Forum
Home : Products : DBMan : Customization :

Excel Mod - Help Mitch, :-0.

Quote Reply
Excel Mod - Help Mitch, :-0.
Mitch or anyone else,

1. My excel mod WORKS! ... but ...
2. I "just" noticed it only exports one page of results.

Specifically, my "View Records" displays 26 names on a search, but my "Export Results" only displays 15 ... which also happens to be the # of records displayed per page of the database.

Any suggestions to get the export to display "all" the results in the spreadsheet?



------------------
Joebagodonuts, JR or Anita
http://home.flash.net/~murgnam/
Quote Reply
Re: Excel Mod - Help Mitch, :-0. In reply to
Hiya Joe!

I can't be sure, since I haven't looked at your mod, but if you're exporting DBMan records, you might try setting $db_max_hits to be some huge number -- more than the number of records in your database -- before you export to Excel. I think that should do it for you.



------------------
JPD





Quote Reply
Re: Excel Mod - Help Mitch, :-0. In reply to
LTNS JPD -- Welcome Back, :-),

Aye, yes, I changed the max hits to the higher #, and that worked, :-). But outside of the Excel mod, the database looks a lot cleaner by having the results at 15 at a time -- not to mention the lag time trying to return 230+ records at one time.

Was hoping Mitch or someone could help me w/the syntax of the Excel mod itself to return an infinite # of results with the mod, while leaving the max hits outside of the mod at the current 15.

I prob shoulda been clearer with my original question. Sorry.

------------------
Joebagodonuts, JR or Anita
http://home.flash.net/~murgnam/
Quote Reply
Re: Excel Mod - Help Mitch, :-0. In reply to
I probably should do a search for your Excel mod to know what I'm talking about Smile, but I'm assuming that the mod does a search and then creates a file to be imported into Excel. Is this right?

If so, at the beginning of the mod, before you do the search, just add

$db_max_hits = 10000000;

or some such humungous number. The number in your .cfg file will stay the same.

I wasn't clear myself, so we're in the same boat. Smile


------------------
JPD





Quote Reply
Re: Excel Mod - Help Mitch, :-0. In reply to
JPD,

Makes sense, 'cept I'm not exactly sure where the
Code:
$db_max_hits = 10000000;

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

...


or in db.cgi/sub export_records
Code:
$db_max_hits = 10000000;

my ($status, @hits) = &query("view");
if ($status eq "ok") {
&export_to_Excel(@hits);
}
else {
&html_view_failure($status);
}
}

I'm sure how I wrote the above is prob wrong, but that's my best guesstimate, <g>

Does this help or hurt?

JR
Quote Reply
Re: Excel Mod - Help Mitch, :-0. In reply to
In the second bit of code above. You just need to set it before the line

my ($status, @hits) = &query("view");

(That is the line that actually does the search. Smile )



------------------
JPD





Quote Reply
Re: Excel Mod - Help Mitch, :-0. In reply to
No such luck, :-(.

I tried in db.cgi/sub export_to_excel and html.pl/sub export_records ...

I even tried in db.cgi/sub view_records, but no luck.

BUT ... I wonder ... in db.cgi/sub query, I see
Code:
# Define the maximum number of hits we will allow, and the next hit counter.
$in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits);
$in{'nh'} ? ($nh = $in{'nh'}) : ($nh = 1);
$numhits = 0;
and
Code:
# Now we go through the database and do the actual searching.
# First figure out which records we want:
$first = ($maxhits * ($nh - 1));
$last = $first + $maxhits - 1;
I wonder if that's the place to work on?

Oh, sh*, I'm thinking out of the box all of a sudden, :-0.

Hopefully, that's good -- more importantly, hopefully you or someone else can chime in, b4 I go modifying to much, ACK!

JR
Quote Reply
Re: Excel Mod - Help Mitch, :-0. In reply to
Is there a thread that I could look at to see the code you're using?


------------------
JPD





Quote Reply
Re: Excel Mod - Help Mitch, :-0. In reply to
The thread? There's Mitch's Excel mod @ http://www.public-knowledge.com/...an/mods/exportXL.txt and there's my current default.cfg, db.cgi and html.pl ... I'm posting the default.txt, db.txt and html.txt to http://home.flash.net/~murgnam/ Is that what yr looking for?
JR
Quote Reply
Re: Excel Mod - Help Mitch, :-0. In reply to
That's fine. I just needed to see some code so I wasn't floundering in the dark. Smile

In db.cgi, sub export_records, before the line

my ($status, @hits) = &query("view");

add

$db_max_hits = 10000000;

Or maybe you should take off one or two 0s. But I don't think that should make a difference.

If you're still having problems, try using

$in{'mh'} = 10000000;

instead of the line above. (Shouldn't make any difference, but it might.)

Whatever you do, don't mess with sub query!


------------------
JPD





Quote Reply
Re: Excel Mod - Help Mitch, :-0. In reply to
VOILA!!!

$db_max_hits = 1000; was a no go,
BUT, $in{'mh'} = 1000;, did the trick.

THANK YOU, THANK YOU, THANK YOU.

Hopefully, Mitch will see this, and encorporate in his mod, :-).

JR


Quote Reply
Re: Excel Mod - Help Mitch, :-0. In reply to
Thanks for letting me know. I didn't think there would be a difference, but obviously there is. You taught me something today! Smile


------------------
JPD