Jump to content

how to get the total pass rate based on the array value,date


lovelylace

Recommended Posts

/*

 

Output of the table will display the Suite based on the distinct date. The pass rate percentage calculate based on the Suite1 and app1 and the specific date.

 

For example at Apr 4 2011, I need to Sum the total passcount,failcount,errorcount of Bluetooth, GPSA, EMIReceiver($app1) of XA9 on Real MXE($suite1) , then calculate the passrate percentages.

 

But I fail to get the correct value of the passcount, failcount, errorcount value.Helps!

 

 

Output of the table

 

 

suite                          Date                      Percentages(pass rate)

 

 

 

XA9 on Real MXE            Apr 4 2011 9:47AM                99.94%

 

XA9 on Real MXE            Apr 5 2011 10:48AM                99.94%

 

XA9 on Real MXE            Apr 6 2011 9:49AM                99.95%

 

XA9.5 on Real EXA_B40      Apr 4 2011 7:06AM                99.94%

 

XA9.5 on Real EXA_B40      Apr 5 2011 7:14AM                99.93%

 

XA9.5 on Real EXA_B40      Apr 6 2011 7:29AM                99.93%

 

 

*/

 

 

 

 

$suite1 --> array value (XA9 on Real MXE, XA9.5 on Real EXA_B40)

 

 

$app1 --> array value (Bluetooth, GPSA, EMIReceiver)

 

 

 

 

if(is_array($suite_type1)){

 

 

foreach($suite_type1 as $suite1)

 

 

$sql222="Select Distinct a.StopDTTM from Suite a,Test b where a.SuiteID=b.SuiteID and b.SuiteID=a.SuiteID and a.StopDTTM>='$fromdate' and a.StopDTTM<='$to_date' and a.SuiteFilePath like '%$Program%' and a.SuiteFileName='$suite1'";

$result222=mssql_query($sql222,$connection) or die("Failed Query of".$sql222);

 

 

                while($row222 = mssql_fetch_array($result222))

{

           

 

        $datetotest = $row222[0];

                        $days_to_add = 1;

                        $tilldate = fnc_date_calc($datetotest,$days_to_add);

 

 

//Query the result based on the date

$sql223="Select Distinct a.SuiteFileName, a.SuiteID,a.StopDTTM from Suite a,Test b where a.SuiteID=b.SuiteID and b.SuiteID=a.SuiteID and a.StopDTTM>='$row222[0]' and a.StopDTTM<='$tilldate' and a.SuiteFilePath like'%$Program%' and a.SuiteFileName='$suite1' order by a.StopDTTM";

$result223=mssql_query($sql223,$connection) or die("Failed Query of".$sql223);

               

             

while($row223 = mssql_fetch_row($result223)){

 

   

foreach($app_type1 as $app1)

                                {

             

 

                                      $sql3="Select Sum(b.passcount),Sum(b.failcount),Sum(b.errorcount) from Suite a,Test b where a.SuiteID=b.SuiteID and b.SuiteID=a.SuiteID and a.StopDTTM>='$row222[0]' and a.StopDTTM<='$tilldate' and a.SuiteFilePath like '%$program%' and a.SuiteFileName = '$suite1' and b.Product='$app1'"; 

      $result3=mssql_query($sql3,$connection) or die("Failed Query of ". $sql3);

              $row3 = mssql_fetch_row($result3);

              $total_passcount+=$row3[0];

      $total_failcount+=$row3[1];

      $total_errorcount+=$row3[2];

 

 

        }

 

      $overall_total=$total_passcount+$total_failcount+$total_errorcount;

 

       

 

    echo "<tr>";

    echo "<td><a href='detailsreport.php?suiteID=".$row223[1]."&suitetype=".$row223[0]."&fromdate=".$fromdate."&to_date=".$to_date."&date=".$row222[0]."&tilldate=".$tilldate."&SuiteFilePath=".$Fprogram."'>" . $row223[0] . "</a></td>";    //Suite File Name

            echo "<td>" . $row223[2] . "</td>";

 

    //Pass percentage

    if($total_passcount>0){

        echo "<td bgcolor=00FF33>" . number_format((($total_passcount/$overall_total)*100),2)."%</td>";

    }

    else{

        echo "<td bgcolor=00FF33>0%</td>";

    }

 

                            }

}

 

 

 

 

    }

 

            echo "</table>";

         

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.