Gossamer Forum
Home : Products : DBMan SQL : Development, Plugins and Globals :

Error in Simple Tag lookup??

Quote Reply
Error in Simple Tag lookup??
I have a global that quite simply sees what type of a doctor the logged in user is and depending on that information it creates a drop down list from a column of choices from a table (in this case it displays Insurance Carrier types). But it recently started giving me errors. Was wondering if somebody else could look at it and tell me what is wrong with the code?

The problem I have traced back to the "DrType" field. While I can manually place a DrType value in like:
" my $DrType = "Podiatry"; " and it works perfectly; when I put in the " my $DrType = $tags->{DrType}; " it doesn't seem to load the DrType value at all. But here is the weird part, when I use the <%DrType%> field in the template it displays correctly as the doctor type. Could something be wrong with my CGI code or how I am referencing that variable?

Code:
sub {
#--------------------------------------------------------------------
# Display the Carriers select list.
#
my $tags = GT::Template->tags;
my $table = $DB->table('Select_Entries');
my $sth = ""; my $key = "";
my $DrType = $tags->{DrType};if ($DrType eq "PTherapy") {
$sth = $table->select (['PTCarriers']);
$key = "PTCarriers";
}
elsif ($DrType eq "Acu") {
$sth = $table->select (['AcuCarriers']);
$key = "AcuCarriers";
}
elsif ($DrType eq "Podiatry") {
$sth = $table->select (['PodCarriers']);
$key = "PodCarriers";
}
else {
$sth = $table->select (['Carriers']);
$key = "Carriers";
}my $output = "<select name=\"Carrier\" id=\"Carrier\" size=\"1\">";
$output .= " <option value=\"\" SELECTED>-- Select One (".$DrType.") --</option>";
while (my $row = $sth->fetchrow_hashref) {
$row->{$key} =~ s/\s+$//;
if($row->{$key} ne ''){
$output .= "<option value=\"".$row->{$key}."\">".$row->{$key}."</option>";
}
} $output .= "</select>";
return $output;
}


This is the output that I get when it is displayed in the form: -- Select One (SCALER(0xa39368c)) --
with all of the "default" [Carriers] carriers list. It should say: -- Select One (Podiatry) -- or something like that.

HELP!!!!

Last edited by:

LanceWilson2: Sep 5, 2005, 2:03 PM
Quote Reply
Re: [LanceWilson2] Error in Simple Tag lookup?? In reply to
Try this:

sub {
my $DrType = shift;
my $table = $DB->table('Select_Entries');
my $sth = ""; my $key = "";
if ($DrType eq "PTherapy") {
......
}
}

Now, you can use <%global_name($DrType)%>

Hope that helps.

TheStone.

B.
Quote Reply
Re: [TheStone] Error in Simple Tag lookup?? In reply to
Nope... that did not work either. Now $DrType is empty when I use just the shift command. I copied the code exactly as you have it. It is also doing the same thing on another global that I have when they should work. I'm beginning to think it is not a syntax thing anymore. I have the GT library as of June 2005 when updated it. I noticed the problem at the end of July but it could have been happening as early as June. Does that help? Support Ticket #16698.

Last edited by:

TheStone: Sep 7, 2005, 10:38 AM
Quote Reply
Re: [LanceWilson2] Error in Simple Tag lookup?? In reply to
Try to put <%GT::Template::dump%> into the template to see if DrType is available. If so, can you send me you admin username and password, I 'll have a closer look at it?

TheStone.

B.
Quote Reply
Re: [TheStone] Error in Simple Tag lookup?? In reply to
The DrType variable is available and contains data, I've already tried that. I'll send you a private email with all of that information you requested.
Quote Reply
Re: [TheStone] Error in Simple Tag lookup?? In reply to
In Reply To:

Now, you can use <%global_name($DrType)%>

Hope that helps.

TheStone.


Ok, the script now works after I specifically pass the "$DrType" variable to the script. Thank You. But I do have to ask if this is a change from before? I used to be able to use the " my $tags = GT::Template->tags; " command to access all of the tag variables from the global script (via $tag). In fact I have about 15 such scripts that worked this way, and now apparently don't. Was this a change in the latest round of library updates? Is there a better way to access variable values from within globals than having to specifically pass them through the function call?