Tracking History in HP QC(Quality Center) - hp-quality-center

Is there a way to tracking a bug's history in QC? What I am trying to get is how many bugs are being reopened over a release and how many times it got reopened. From the QC, I can only see the "status" as "closed" but it won't give me the information about have many times it changed from "closed" to "reopen" then "fixed" then "reopen" then "closed".
Thanks in advance!

Audit history table of QC has information stored for every change in the QC element(here the Bug). So you can write a SQL query that retrieve reopen defects. I call them as first time fix failures and they provide good evidence on why there is more testing happening when you got more of them
Below is the blog link which has this information and tells how to extract with an example of SQL query
First time failures

The history table does not automatically track everything so make sure first that wherever possible to mark it in the customization field module to track history.
If you are using QC via Saas and have no access to Sql Server, you can always do it via the OTA (QC Api) and use sql there.
Other alternative, use the workflow and write in a file, maybe a xml one (using vbscript) on the onchanged event or rather onsaved event of the relevant QC module.

You could create an SQL query (directly query the db, or use QC's "great" dashboard and an Excel query there) that looks at the rows in the history table for that field and defect number.
The documentation should have enough examples for queries like these that you should be able to come up with a usable query that either works or can be discussed here if you post it.

The key here is that we have an explicit 'Reopen' state in the workflow and we can test for this. Not as a current state but how many times we move through the state. This is easily done as a custom Excel Report.
As Anthony Hilyard shows, it is essentially a join between the Bug table and the audit log/property table. To get the release, you also need to join with the Releases table. We use both the detected in release and the targeted release. The targeted release moves on to the current release for any open defect so we coalesce them together so if there is no target release, it uses the current release. Unlike Anthony's solution, we just want to count the reopens, rather than list them.
The SQL to look in Release, '#RelNam#' would look like this:
SELECT
BG.BG_BUG_ID As 'Defect ID',
BG.BG_STATUS As 'Status',
COUNT(AU.AU_ACTION_ID) As 'Reopens',
BG.BG_DETECTED_BY AS 'Detected By',
BG.BG_SUMMARY As 'Summary'
FROM BUG BG
LEFT JOIN AUDIT_LOG AU ON BG.BG_BUG_ID = AU.AU_ENTITY_ID
INNER JOIN AUDIT_PROPERTIES AP ON AU.AU_ACTION_ID = AP.AP_ACTION_ID
INNER JOIN RELEASES RLS ON RLS.REL_ID = COALESCE(BG.BG_TARGET_REL,BG.BG_DETECTED_IN_REL)
WHERE 1=1
AND RLS.REL_NAME = '#RelNam#'
AND (AU.AU_ENTITY_TYPE = 'BUG' OR AU.AU_ENTITY_TYPE IS NULL)
AND AU.AU_ACTION = 'UPDATE'
AND (AP.AP_PROPERTY_NAME = 'Status' AND AP.AP_NEW_VALUE = 'Reopen')
GROUP BY
BG.BG_BUG_ID,
BG.BG_STATUS,
BG.BG_DETECTED_BY,
BG.BG_SUMMARY
ORDER BY BG.BG_BUG_ID
If you want to use date instead, drop the join with releases and the associated WHERE clause and just use a test for BG_DETECTION_DATE instead.
If you don't have an explicit 'Reopen' state but your workflow has a 'Retest' and 'Fix', you can instead look for the number of transition events involving old state=Retest and new state='Fix'. This will exclude first time through, only where a defect is reopened.
Remember if you want to add columns in the output, make sure they are also in the 'Group By' clause at the bottom.

Here is an Excel SQL Extract I use:
SELECT
"defect"."BG_BUG_ID" AS "Defect",
"defect"."BG_STATUS" AS "Status",
"defect"."BG_SEVERITY" AS "Severity",
"defect"."BG_PRIORITY" AS "Priority",
"defect"."BG_USER_03" AS "Category",
"defect"."BG_USER_01" AS "Modules",
"defect"."BG_USER_08" AS "EFD",
"defect"."BG_USER_02" AS "Region",
"defect"."BG_SUMMARY" AS "Summary",
"defect"."BG_DETECTED_BY" AS "Detected By",
"audit_log"."AU_ACTION" AS "Action",
"audit_log"."AU_USER" AS "User",
"audit_property"."AP_OLD_VALUE" AS "Old Value",
"audit_property"."AP_NEW_VALUE" AS "New Value",
"audit_log"."AU_TIME" AS "Change Time",
"audit_property"."AP_PROPERTY_NAME" AS "Change Area"
FROM
BUG "defect"
INNER JOIN AUDIT_LOG "audit_log" ON "defect"."BG_BUG_ID" = "audit_log"."AU_ENTITY_ID"
INNER JOIN AUDIT_PROPERTIES "audit_property" ON "audit_log"."AU_ACTION_ID" = "audit_property"."AP_ACTION_ID"
WHERE
"audit_log"."AU_ENTITY_TYPE" = 'BUG'

Related

Get Requsition ID based on PO

In FSCM I am looking to modify the Search view on Add/Update PO page (Main Menu--> Purchasing--> Purchase Orders--> Add/Update POs) to display the Requisition ID associated with the PO in the search results page. The only table I have found that has both PO_ID and REQ_ID is PS_PO_LINE_DISTRIB however unless I use a SELECT DISTINCT clause I will get multiple PO_ID rows when there are more than 1 line on a PO.
Within Purchase Order Inquiry you can see the related Requisition ID's related to a PO by clicking on Document Status link inside the Purchase Order inquiry details page.
I started looking at the PeopleCode within the the Purchase Order Inquiry to see how they are linking the PO to a Requisition and it appears to use work tables with related PeopleCode function libraries, but I wasn't able to figure our how they get linked. I am hoping someone else may know the answer to this. Thank you.
I'm on an old version of PeopleSoft (SCM 8.80, Tools 8.51), so your mileage may vary. I'm assuming you're familiar with App Designer. If not, comment below and I'll add some details about what I'm clicking on.
Find the name of the Add/Update PO component.
Open the PURCHASE_ORDER component in App Designer. Now let's find the name of the search record. Note that there is a different record for the Add Search Record, so if you want to change that too, do all of this for that record as well.
Open the PO_SRCH record, and add the REQ_ID field to it. Make sure you mark the field as a key. You should consider saving your modified PO_SRCH under a new name in case you want to be able to revert to vanilla PeopleSoft. If you do, change the Search Record in the component to your new record name.
We can see that PO_SRCH is a view. So let's modify the view to pull in REQ_ID from PO_LINE_DISTRIB. As you mentioned above, there doesn't appear to be another table with both PO_ID and REQ_ID, so you'll have to do a SELECT DISTINCT.
We should do a LEFT OUTER JOIN instead of a standard join because if you do a standard join and you enter a purchase order with no lines and save it, then you'll never be able to retrieve that purchase order in this window. Since REQ_ID is a key field, we can't have a null, so we have to do the CASE.
One odd thing that I ran into here was building the view now gave me an error about selecting fewer columns in the SQL than I had in my record definition. I solved it by modifying the view for SQL Server. I've never had to do that before and I don't know why I had to do it for this specific record. But anyway, I entered the same SQL under the record's "Microsoft SQL Server" definition.
In the properties of PO_SRCH, we can see that it has a related language record. If you're only using one language, you can probably get away without changing this, but I'll do it for completeness. Open PO_SRCHLN. Now add REQ_ID to it (mark it as a key field like you did above), and save it as PO_SRCHLN2 (I'm saving it under a new name so I don't break anything else that may be using PO_SRCHLN).
Edit the SQL the same was as you did above. Note: I didn't have to also change the Microsoft SQL Server definition like I did above. I have no idea why.
Now build PO_SRCHLN2.
Go back to PO_SRCH and change its related language record to PO_SRCHLN2.
Now build PO_SRCH.
Hopefully you didn't get any errors and your search page has the requisition ID in it now. My system doesn't use requisitions so they're all blank in the example below, but the new field is there.

Iteration over VendTransOpen

This happens in Accounts Payable -> Journals -> Payments -> Payment Journal.
I choose to see the Lines for a journal and from Functions I select Settlement. I am not sure if this is the same for everyone else.
So, when clicking Settlement, VendOpenTrans opens. I need to iterate over it, and Mark the records according to the invoice of the previously selected LedgerJournalTrans field.
First of all I have to check the VendOpenTrans fields which I am not able to accomplish.
I have added the following piece of code in the init of VendTransOpen:
VendTrans vt;
vt = vendTransOpen_ds.getFirst(true) as VendTrans ;
while (vt)
{
//Do your thing
vt= vendTransOpen_ds.getNext() as VendTrans ;
}
No elements seem to be present in the vendTransOpen_ds..
Can someone give me a hint about this?
Update 1:
Found this :
Understanding the Settlement Mechanism in Microsoft Dynamics AX
and
Automatic mark a Settlement Transactions on a Payment Journal in AX 2012
I didn't think it would be so damn difficult.. I will start digging tomorrow.
Several things are wrong, but probably my #2 is your main problem.
If you place this code in the init method, the query hasn't been executed yet, so nothing will be there. See https://msdn.microsoft.com/en-us/library/aa608211.aspx
Your code will never enter while (vt) because vt will never have a value as written because VendTrans and VendTransOpen are two different tables that don't support inheritance.
The only reason vt = vendTransOpen_ds.getFirst(true) as VendTrans ; doesn't throw an error is because FormDataSource.getFirst()/getNext() returns a Common table record.
What Jan said too.
First off, use getFirst(0) before using getNext().
The zero indicates you want all records rather than marked.
Search, use cross reference tool, or google to get lots of references for the use of these functions.

Database table in which WTPart or Change activity Maturity History is stored

I need to pull the date on which a WTPart was in inwork state or A CN was in published state.
I did my analysis and found that there should be a Maturity history table in database, but i ended up with a table called MaturityBaseline table which does not hold this information. I need guidance on which table this information is stored. Even in API com.ptc.windchill.enterprise.history.HistoryTablesCommands.maturityHistory(wtObject); they are using Maturity History class.
Have you tried this method from same class?
com.ptc.windchill.enterprise.history.HistoryTablesCommands.getLegacyLifeCycleHistory(LifeCycleManaged arg0);
I have never tried by myself though. Also check for HistoryRecord table in database whether it have any info related to this.
I know this question is may years old now, but I stumbled across it looking at how to find the history of a change issue/problem report.
My problem report has a number TA00025 and I want to find when it was completed. The enter_phase action will tell me whenever the state has changed. This SQL will tell me changes of state for the nominated change issue/problem report (the same object type in Windchill)
select LH.action, LH.state, LH.updateStampA2
from wcadmin.[wcadmin].ObjectHistory OH, wcadmin.[wcadmin].LifeCycleHistory LH,
wcadmin.wcadmin.WTChangeIssueMaster CIM, wcadmin.wcadmin.WTChangeIssue CI
where OH.idA3A5 = CI.idA2A2
and OH.idA3B5 = LH.idA2A2
and CI.idA3masterReference = CIM.idA2A2
and CIM.WTCHGISSUENUMBER = 'TA00025'
and LH.action = 'Enter_Phase'
For a WTPart the history all sits in the table WTPart which will have a full history for a part wth multiple records.

asp.net multi-row update with gridview control without looping (vb.net)

I'm pretty new to asp.net. I'm building my first real app as a test. using SQL Server 2008 RS, VS Express 2012, IIS7.x and asp.net4.0
We receive Fedex shipment info every night that gets inserted into an MSSQL DB using SSIS. We then import the invoice, do variance matching and book costs to jobs based on the job no in Ref1 field. All this works great. However, the shipping department are supposed to put the ONLY the JobNo in the ref1 field. Of course they don't and there a lot of temps and shipping stations, so we need to fix the data. They'll put JobNo followed by junk, or junk and then the job no. When the costing people are looking at the invoice it's usually obvious what the job no is (e.g. "Samples for job 123" should be "123"). There can be many rows with the same Ref1 that needs editing (e.g 20 cartons with same Ref1). I have an SP with 3 params (OldRef, NewRef, invNo) that updates the Ref no for all records on that invoices:
UPDATE InvoiceLines
SET REF1 = #NewRef1
WHERE InvNo = #InvNo and Ref1 = #OldRef1
I figured a GridView (with an sqldatasource) would be a nice way to present the data. I only show rows where the Ref1 field is invalid, as the user corrects them, the no of records reduces.
I want the user to select a row, edit the Ref1 value and I'd just get the (old) RefNo of the selected row, it's new value, and call my SP with those and the InvNo (from a DropDown that filtered the invoice lines table).
Turns out to be way more difficult/inefficient that I thought.
All the examples I found to do this type of thing, make the user click all the rows and them loop through every row to do an update. Talk about slow and painful. I want to execute a single SP and have all matching rows updated and then refresh the list.
So what I'd like to figure out is how to get the OLD Ref1 (value in Ref1 before the edit - like deleted in an SQL trigger), the NEW Ref1 (edited value that the user typed in Ref1 - like inserted in an SQL trigger) and execute my SP and then refresh the table with the updated value result set.
Am I better off with something other than a grid view, or just using something other than the built in Edit command?
If I do figure out how to do the update, how do I refresh the GridView.
Can anyone point me in the right direction?
On another note, I'm on the fence about switching to C#. Most of the examples I'm finding are in C#. I learned C++ many years ago and read up on C# at weekend. It doesn't seem too difficult. I did find a Microsoft white paper and it pretty much said there's little difference between VB and C# so no real reason to switch. My colleagues do not know C or C#, so I'm just a bit concerned that in the unlikely event they need to help out, they'll be stuck. Any thoughts on this?
Regards
Mark

After join, cannot filter by attribute qty - getting products from inventory that are in stock

You have been so helpful in the past that I keep coming back searching for help and learning.
This time I am trying to get all products that have a quantity greater than 1 and that are in stock (is_in_stock = 1)
$products = Mage::getModel('catalog/product')->getCollection();
//$products->addAttributeToSelect('*');
//SELECT `e`.*, `stock`.`qty` FROM `catalog_product_entity` AS `e` LEFT JOIN `cataloginventory_stock_item` AS `stock` ON stock.product_id = e.entity_id
$products->getSelect()->joinLeft(
array('stock'=>'cataloginventory_stock_item'),
'stock.product_id = e.entity_id',
array('stock.qty', 'stock.is_in_stock')
);
This returns qty and is_in_stock columns attached to the products table. You can test it as follows:
$products->getFirstItem()->getQty();
$products->getFirstItem()->getIsInStock();
The issue begins when I try to filter by qty and is_in_stock.
$products->addFieldToFilter(array(
array('Qty','gt'=>'0'),
array('Is_in_stock','eq'=>'1'),
));
This returns - Invalid attribute name never performing filtering. I am guessing it is trying search for e.qty but cannot find it.
So, I tried to filter differently:
$products->getSelect()->where("`qty` > 0");
$products->getSelect()->where("`is_in_stock` = 1");
This is not filtering as well even though, if you look at its sql query, (var_dump((string) $products->getSelect())), and run that query in phpMyAdmin, it works.
Alan Storm in his tutorial mentions that 'The database query will not be made until you attempt to access an item in the Collection'. So, I make the $products->getFirstItem() call but it still not executing the query or filtering in another words.
What am I doing wrong? Any ideas how to filter by attributes that are joined to the table?
Thank you again,
Margots
I would suggest that you try using $products->addAttributeToFilter... instead of $products->addFieldToFilter... - the addField method only works when the field is on the main table that you are querying (in this case catalog_product_entity). Because the inventory fields are in a joined table, you need to use addAttribute.
Hope this helps,
JD
After looking under the hood I learned that _selectAttributes instance field was not assigned in Mage_Eav_Model_Entity_Collection_Abstract class and that is why get exception. A solution usually would be what Jonathan Day suggested above - add addAttributeToFilter() method, however. It will return error since it cannot find such attribute for catalog/product. (qty and in_invetory are in cataloginventory_stock_item). I found two solutions to my problem both required going different direction:
One involved pursuing a way to query the Select statement that I had set for product collection(see above) but somehow it was not resetting the collection with new product. WhenI copied that Sql statment in phpMyAdmin, it worked, so how to query that statement from product collection:
$stmt = $products->getConnection('core_write')->query($products->getSelect()->__toString());
while($rows = $stmt->fetch(PDO::FETCH_ASSOC)){
echo "<br>Product Id ".$rows['entity_id'];
}
Instead of using catalog/product entity table I used the flat table - cataloginventory_stock_item to accomplish the same thing
$stockItem = new Mage_CatalogInventory_Model_Stock_Item();
$stockItems->addQtyFilter('>',0);
$stockItems->addFieldToFilter('is_in_stock',array('eq'=>'1'));
Now there is a collection of all products with qty > 0 and that are in stock.

Resources