Hi all,
using DBman flatfile......
I'm using the "sort by multiple fields" mod sorting on 3 fields (with great success, I should say). But I do have one problem. This mod only works if $values[$in{'sb1'}] contains 1 single value. In my case I have multiple values in this field (db position is 1). I know, I know, but I wanted to try it anyway.....
Now, I figured out to add the following in sub query just after:
open (DB, "<$db_file_name") or &cgierr("error in search. unable to open database: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB>) {
(/^#/) and next LINE; # Skip comment Lines.
(/^\s*$/) and next LINE; # Skip blank lines.
$line = $_; chomp ($line); # Remove trailing new line.
@values = &split_decode($line);
# my new code
# $values[1] being the sort field in question
if ($in{'view_select_records'}) {
@tmp_value = split(/\|/, $values[1]); #$values[1] in this case eq "value1|value2|value3" etc.
foreach $tmp_value (@tmp_value) {
$values[1] = $tmp_value;
}
push (@values, $values[1]);
}
# end
this does not interfere with any of my other search routines and prints out the record with multiple field values no problemo, but uses only 1 of the available field values (not necessarily the first one?). In other words, it does not make a "temporary copy" (for want of a better word) of the record (or should I say $line). How can I stack all the newly assigned $values[1] in @values? I need to "push" @values so that I don't have to worry about the rest of sub query or any other subsequent sorting functions. This also lets me call $rec{'fieldname'} as usual.
I know I'm missing something rudimentary....I've tried everything I can think of and I'm not one to give up easily....been on this thing for hours.
Thanks for any help.
Nora
Nora @
www.baytides.ca
using DBman flatfile......
I'm using the "sort by multiple fields" mod sorting on 3 fields (with great success, I should say). But I do have one problem. This mod only works if $values[$in{'sb1'}] contains 1 single value. In my case I have multiple values in this field (db position is 1). I know, I know, but I wanted to try it anyway.....
Now, I figured out to add the following in sub query just after:
open (DB, "<$db_file_name") or &cgierr("error in search. unable to open database: $db_file_name.\nReason: $!");
if ($db_use_flock) { flock(DB, 1); }
LINE: while (<DB>) {
(/^#/) and next LINE; # Skip comment Lines.
(/^\s*$/) and next LINE; # Skip blank lines.
$line = $_; chomp ($line); # Remove trailing new line.
@values = &split_decode($line);
# my new code
# $values[1] being the sort field in question
if ($in{'view_select_records'}) {
@tmp_value = split(/\|/, $values[1]); #$values[1] in this case eq "value1|value2|value3" etc.
foreach $tmp_value (@tmp_value) {
$values[1] = $tmp_value;
}
push (@values, $values[1]);
}
# end
this does not interfere with any of my other search routines and prints out the record with multiple field values no problemo, but uses only 1 of the available field values (not necessarily the first one?). In other words, it does not make a "temporary copy" (for want of a better word) of the record (or should I say $line). How can I stack all the newly assigned $values[1] in @values? I need to "push" @values so that I don't have to worry about the rest of sub query or any other subsequent sorting functions. This also lets me call $rec{'fieldname'} as usual.
I know I'm missing something rudimentary....I've tried everything I can think of and I'm not one to give up easily....been on this thing for hours.
Thanks for any help.
Nora
Nora @
www.baytides.ca