I have the following function in a DbMan SQL "custom.pm" file:
sub GetClaimData {
#--------------------------------------------------------------------
# Fetch a row of data in the Claims database.
#
my $tags = GT::Template->tags;
my $id = $tags->{ClaimID};
my $info = $tags->{home}->{sql}->table('Claims')->get ($id);
# I'm just playing here.
# if($info->{'InsuredID'} eq '') { my $info->{'InsuredID'} = $tags->{'InsuredID'}; }
# if I try this... this is what I get:
# Can't use an undefined value as a HASH reference at /home/www/html/code/admin/Dbsql/custom.pm line 65.
return $info;
}
The purpose of it is to grab an entire row of data for an SQL source.
Problem:
I want to evaluate one of the columns (InsuredID) in that row and see if it is blank (eg. equal to ''), if it is, then I want to replace it with an existing variable (eg. in this case $tags->InsuredID) My problem lies in that I do not know how to break apart $info and evaluate that column and the other part is how do I replace the new variable back into the $info data array?
Am I close with the playing around above??
sub GetClaimData {
#--------------------------------------------------------------------
# Fetch a row of data in the Claims database.
#
my $tags = GT::Template->tags;
my $id = $tags->{ClaimID};
my $info = $tags->{home}->{sql}->table('Claims')->get ($id);
# I'm just playing here.
# if($info->{'InsuredID'} eq '') { my $info->{'InsuredID'} = $tags->{'InsuredID'}; }
# if I try this... this is what I get:
# Can't use an undefined value as a HASH reference at /home/www/html/code/admin/Dbsql/custom.pm line 65.
return $info;
}
The purpose of it is to grab an entire row of data for an SQL source.
Problem:
I want to evaluate one of the columns (InsuredID) in that row and see if it is blank (eg. equal to ''), if it is, then I want to replace it with an existing variable (eg. in this case $tags->InsuredID) My problem lies in that I do not know how to break apart $info and evaluate that column and the other part is how do I replace the new variable back into the $info data array?
Am I close with the playing around above??