Gossamer Forum
Home : Products : DBMan : Customization :

Send Record Mod - remove blank lines in email

Quote Reply
Send Record Mod - remove blank lines in email
I am using the send record mod and I am sending the following data, but I would like to exclude fields that are blank and not have a blank line (sub html_forward_email_form). Are their if statements and how would I make one? If 'Telephone2' field has no data entered, how do I get it to not print the label, Tele2: and not leave a blank line.

$rec{'First Name'} $rec{'Last Name'}
$rec{'Degrees/Certifications/Modalities'}
$rec{'City'}, $rec{'State'} $rec{'Zip Code'}
$rec{'Country'}
Tele: $rec{'Telephone'}
Tele2:$rec{'Telephone2'}
Fax: $rec{'Fax'}

mailto:$rec{'E-mail'}
$rec{'Web Address'}

$rec{'Comments/Business'}
|;
}
}
&html_print_headers;

Thanks,
Tommy Gardner


Quote Reply
Re: Send Record Mod - blank lines In reply to
Simply use conditional if statements, like the following:

Code:

if ($rec{'Telephone'} ne "") {
print MAIL "Telephone: $rec{'Telephone'}";
}
if ($rec{'Telephone2'} ne "") {
print MAIL "Telephone 2: $rec{'Telephone2'}";
}


Of course you could also add else statements that puts something like Not Available after the colon.

Like the following:

Code:

if ($rec{'Telephone'} ne "") {
print MAIL "Telephone: $rec{'Telephone'}";
}
else {
print MAIL "Telephone: Not available";
}
if ($rec{'Telephone2'} ne "") {
print MAIL "Telephone 2: $rec{'Telephone2'}";
}
else {
print MAIL "Telephone 2: Not available";
}


BTW: ne = NOT EQUALS

Regards,

Eliot Lee

Quote Reply
Re: Send Record Mod - blank lines In reply to
Elliot,

Many thanks. I really appreciate the time and detail of your response.

Appreciatively,
Tommy

Quote Reply
Re: Send Record Mod - blank lines In reply to
Can I prevent blank lines in the following, I can not get fi statements to work:

sub html_forward_email_form {
#----------------------------------------------------------
my $font_color= 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#990066';
my ($message) = $_[0];
$in{$db_key} =~ s/<?.B>//g;
%rec = &get_record($in{$db_key});

unless ($in{'email_message2'}) {
foreach $col (@db_cols) {
$in{'email_message2'} = qq|

|;
}
}

unless ($in{'email_message'}) {
foreach $col (@db_cols) {
$in{'email_message'} = qq|
Stillpoint

$rec{'First Name'} $rec{'Last Name'}
$rec{'Degrees/Certifications/Modalities'}
$rec{'City'}, $rec{'State'} $rec{'Zip Code'}
$rec{'Country'}

Tele: $rec{'Telephone'}
Tele2:$rec{'Telephone2'}not print if no data
Fax: $rec{'Fax'}

mailto:$rec{'E-mail'}
$rec{'Web Address'}

$rec{'Comments/Business'}

|;
}
}

&html_print_headers;

Thanks,
Tommy


Quote Reply
Re: Send Record Mod - blank lines In reply to
Eliot, the code will not work under the sub html_forward_email_form. I know that it is set up to print everything, but I do not know how to add code or change the code where it will not leave balnk lines.

Please help if you can.

Tommy


Quote Reply
Re: Send Record Mod - blank lines In reply to
Try this.

Tele: $rec{'Telephone'}|;

if ($rec{'Telephone2'}) {
qq|
Tele2:$rec{'Telephone2'}|;}
qq|
Fax: $rec{'Fax'}