CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
Trying to find the Median Time Please help

 



YAYABRUCE
Novice

Aug 14, 2008, 8:36 AM

Post #1 of 2 (2467 views)
Trying to find the Median Time Please help Can't Post

Hello,

I am trying to find the median time in perl. I am getting all my data from a database. Now, there is a table name Defect that has a column name priority. In priority, I have 0-critical, 1-high and so on. I am trying to get the median time for each of these . Please see below. When I run the entire program, it basically give me the count of the tickets instead of the median time. Please see below.

@data = ();
my @priorities = ("0-critical","1-high","2-medium","3-low");
$median = $Array[($#Array /2)];

$SQLcmd = "SELECT COUNT(*) ";
$SQLcmd = $SQLcmd . "FROM Defect INNER JOIN statedef ON Defect.state = statedef.id ";
$SQLcmd = $SQLcmd . "WHERE (solution_date BETWEEN '${startDate}' AND '${endDate}') ";
$SQLcmd = $SQLcmd . "AND (priority = '${thispriority}') ";
$SQLcmd = $SQLcmd . "AND (found_in = ('MAL') OR found_in = ('KOL')) ";
$SQLcmd = $SQLcmd . "AND (keyword_1 = ('Financials') OR keyword_1 = ('Claims') OR keyword_1=('DSS') ";
$SQLcmd = $SQLcmd . "OR keyword_1=('Conversions') OR keyword_1=('Medical Necessity') OR keyword_1 = ('Rules')) ";
$SQLcmd = $SQLcmd . "AND (defect.prod_proc = ('ClearCase') OR defect.prod_proc = ('CharmNT') ";
$SQLcmd = $SQLcmd . "OR defect.prod_proc=('CM Tools') OR defect.prod_proc=('File Ship') ";
$SQLcmd = $SQLcmd . "OR defect.prod_proc=('Website') OR defect.prod_proc is null) ";
$SQLcmd = $SQLcmd . "AND (statedef.name = ('solved') OR statedef.name = ('validated'))";

print "$SQLcmd\n";
getDBData($SQLcmd,"CEP");
print "$temp_sql_data\n";
print "$median\n";
}


$MedianCriticalCount = $data[0];
$MedianHighCount = $data[1];
$MedianMediumCount = $data[2];
$MedianLowCount = $data[3];



This is the result I get:

0-critical 3
1-high 5
2-medium 4
3-low 1

The result I am suppose to get is 1.72 for 0-critical

1-high 1.15

2-medium 2.49

3-low 1.10


KevinR
Veteran


Aug 14, 2008, 12:56 PM

Post #2 of 2 (2456 views)
Re: [YAYABRUCE] Trying to find the Median Time Please help [In reply to] Can't Post

I don't know the answer, and I doubt its even perl, its your SQL commands, but what I find odd is why you posted this question in the regular expressions forum.
-------------------------------------------------

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives