Gossamer Forum
Home : Products : DBMan : Customization :

temporary copy of record in sub query

Quote Reply
temporary copy of record in sub query
Hi all,

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]);
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. In other words, it does not make a "temporary copy" (for want of a better word) of the record. 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.....but my perl knowledge is....well rudimentary at best:)

Thanks for any help.

Nora
Nora @
www.baytides.ca

Last edited by:

baytides: Oct 8, 2003, 7:06 AM
Quote Reply
Re: [baytides] temporary copy of record in sub query In reply to
sorry about this!

You are welcome to delete this post. I posted it in the Perl Programming forum instead.
Nora @
www.baytides.ca