Gossamer Forum
Home : Products : DBMan : Customization :

How do I email all related data on add_success?

Quote Reply
How do I email all related data on add_success?
I have an add_success email confirmation that also includes some related data. Problem is that it only sends the first related data row and not the others. Here is the code I'm using to make the switch:-

$rec{'UserID'} =~ s/<?.B>//g;

undef %in;
$in{'UserID'} = $rec{'UserID'};
$in{'mh'} = 100;

my ($status2,@hits2) = &query("view");

if ($status2 eq "ok") {
my ($numhits2) = ($#hits2+1) / ($#db_cols+1);
for (0 .. $numhits2 - 1) {
%rec3 = &array_to_hash($_, @hits2);
}

}
%rec3 = &get_record($rec{'UserID'});

and then my print mail has:-

print MAIL "Contract info as follows:-\n\n";
foreach $col (@db_cols) {
print MAIL "$col -- $rec3{$col}\n";

}
close (MAIL);

Which is ok but I only get the one related item (the first one sorted in counter ID order) when I really need to email all related records.

Any ideas?
TIA
Rob


Quote Reply
Re: How do I email all related data on add_success? In reply to
Ok, if I uncomment the following:-
#%rec3 = &get_record($rec{UserID});
I get the first related record, if I leave it out then I get the last record. Now I know this must have something to do with the count on the related record. In the record long view the many related items are displayed ok as the string to display included a countid. Any thoughts on how I can do something similar on the email??

thanks,
Rob