since you are serving it from your website that seems to be some wort of homebrew javascript package. As such we will be of little use in helping you prepare the statements that will properly call it. Possibly somebody else at work can help you with that
in the meantime you can work on getting your input data prepared correctly. From what you have shown %TABLE_DATA is empty.
Each time you reference $TABLE_DATA{5}{'ENTRY'} it will have the same data, it makes no difference if the label is Vcs or Adice. possibly you meant $TABLE_DATA{5}{'Vcs'} instead. what would even make more sense would be $TABLE_DATA{'jobs_running'}{'Vcs'}. we once showed you a way to translate the data returned by my $table = $sth->fetchall_arrayref; into data of that form.
Because i would like this exercise in futility to end quicker i propose something like
sub print_overall_summary
{
my $str = shift;
$DBH = &connect or die "Cannot connect to the sql server \n";
$DBH->do("USE $str;");
my $stmt="select queue_name,jobs_pending,jobs_running from summary o
+rder by time desc ;";
;
my $sth = $DBH->prepare( $stmt );
$sth->execute() or print "Could not prepare_overall_summarydata";
print "<script language=\"javascript\" type=\"text/javascript\"> \n"
+;
print "\$(document).ready(function(){ \n";
%TABLE_DATA =();
my @sys=qw/Adice Incisive Vcs other/;
my $table = $sth->fetchall_hashref;
for my $r (@$table) {
my $name='other';
for my $s (@sys){
if ($r->{queue_name)=~m/$s/i) {$name=$s; last;}
}
$TABLE_DATA{$name}{jobs_pending}+=$r->{jobs_pending};
$TABLE_DATA{$name}{jobs_running}+=$r->{jobs_running};
}
for my $var(qw/running pending/) {
my @parts=();
for my $s (@sys){
push @parts,'["'.$s.'",'
.$TABLE_DATA{$s}{'jobs_'.$var}
.']';
}
print 'var data_'.$var.'=['.join(',',@parts).']'."\n";
}
print " \n pieChart(\"placeholder39\",data_running,{title:\"<b><ce
+nter>Jobs Running</center></b>\"});\n";
print " \n pieChart(\"placeholder41\",data_pending,{title:\"<b><ce
+nter>Jobs Pending</center></b>\"});\n";
print "});";
print "</script>";
}
Untested, if there are syntax errors it s up to you to fix them.
notice you have not made any variables for data_machine or data_cpu so those piecharts would fail.
You need to talk to your boss about how these tasks are way beyond your abilities even though they are so simple. And how you need to get others to do your work for you.
Or you could make and effort to learn perl instead |