![]() |
Telelogic SYNERGY (steve huntington) | ![]() |
Topic Title: Obtaining Child CR ids from csapi Topic Summary: Created On: 6-Apr-2006 16:00 Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
I am looking to somehow retrieve a list of child CR ids associated with a Parent CR using the csapi. It looks as if the only supported way to do this is with a report. However, I can not figure out a way to get the data I need without having to parse through a ton of html code. Is there a way to simply retrieve the Child CR ids associated with a parent CR? Here is the code I have which retrieves the correct information surrounded by heaps of html:
eval { my $queryString = "(cvtype='problem') and is_subsystem_cr_of('probtrac/problem/problem1620/1')"; my $results = $csapi->ImmediateQueryHtml($aUser, "Fix Review Report", $queryString, undef, "Subsystem CRs for 1620"); my $report = $results->getResponseData(); print "$report"; }; |
|
![]() |
|
![]() |
|
Okay, so I figured out a solution, but if anyone has a better way - please let me know.
Here is what I did: eval { my $queryString = "(cvtype='problem') and is_subsystem_cr_of('probtrac/problem/problem1620/1')"; my $results = $csapi->QueryStringData($aUser, "Fix Review Report", $queryString, "problem_number"); my $report = $results->getXmlData(); my $size = $results->getDataSize(); my $i = 0; for ($i = 0; $i < $size; $i++) { my $number = $results->getDataObject($i)->getDataObjectByName("problem_number")->getValue(); print "$number\n"; } }; |
|
![]() |
|
![]() |
|
That is essentially the solution that Telelogic consultants gave me for a similar problem (I was after the parent CR for the child CR, so that the owner of the parent could be notified by email).
Their solution (hacked from an existing solution) was essentially: In my example (snippet below) the report name is a parameter to the script, and the CR number is obtained from the active session (because this was designed to be a trigger from the lifecycle). The "$i" loop is probably not needed because there should be exactly one CR returned, but it provides a "fail safe" for cases where zero or many CRs are returned from the query. |
|
![]() |
Telelogic SYNERGY
» SYNERGY/Change
»
Obtaining Child CR ids from csapi
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.