tags:

views:

557

answers:

2

I have a list of defect ID numbers contained in a Word document and want to know if there is a way to use that list in a ClearQuest query or an SQL query in ClearQuest to move just those defects to a new State. We're talking possibly hundreds of defects out of many hundreds, so I don't want to individually select the defects from all defects.

Thank you.

A: 

I have the same question, have you got answer from somewhere?

A: 

If you are ok using CQPerl you can easily do that in an external script.

Read in the data, then loop through it like:

foreach $id (@idList) {
    my $entity = $session->GetEntity('defect', $id);
    $session->EditEntity($entity, $action);
    my $validate = $entity->Validate();
    print "Validate results $validate.";
    $entity->Commit();
}

If you need to read directly from word, you can see here: http://www.wellho.net/solutions/perl-using-perl-to-read-microsoft-word-documents.html

use Win32::OLE;
use Win32::OLE::Enum;

$document = Win32::OLE -> GetObject($ARGV[1]);
open (FH,">$ARGV[0]");

print "Extracting Text ...\n";

$paragraphs = $document->Paragraphs();
$enumerate = new Win32::OLE::Enum($paragraphs);
while(defined($paragraph = $enumerate->Next()))
    {
    $style = $paragraph->{Style}->{NameLocal};
    print FH "+$style\n";
    $text = $paragraph->{Range}->{Text};
    $text =~ s/[\n\r]//g;
    $text =~ s/\x0b/\n/g;
    print FH "=$text\n";
    }
rob