Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl/ClearQuest Multiple record issue with 2 tables

Status
Not open for further replies.

mstelmac

Technical User
Oct 22, 2003
53
0
0
US
First off, thanks for looking, and if you feel this should be in another area please
let me know, thanks.

I have two tables(DB's) Shown below. These are within ClearQuest V. 2003.06.......
I would like to place a perl hook into the field Labeled Table2_Text on Table2.
What I want to happen is Wherever table2_001 for example is in table1_Text
output the field labeled "Table1_Number" essentially the unique record into a text box or list.
It is possible for this to be in multiple records and I would like to be able to
list all of the records as is done below.
Any help with regard to the below script, field data types, the controls type that the data should be output to,
etc, etc, etc, would be greatly appreciated.

sub associated_text_ChoiceList{
my($fieldname) = @_;
my @choices;
# $fieldname as string scalar
# @choices as a string array

my $session = $entity->GetSession();
my $num_var = $entity->GetFieldValue("Table2_Number")->GetValue();
my $query = "select Table1_Number from Table1 where Table1_Text like '%$num_var%'";
my $resultSet - $session->BuildSQLQuery($query);
$relutSet->Execute();

if($resultSet->MoveNext() == $CQPerExt::CQSUCCESS){
push(@choices, $resultSet->GetColumnValue(1));
}
else{
push(@choices, "not working");
}

return @choices;
}



Table1
--------------------------------------------------------
Table1_Number | Table1_Text
(short string) | (mulitline_string)
--------------------------------------------------------
table1_001 | table2_002, table2_001
table1_002 | table2_001
table1_003 | table2_001, table2_002, table2_003
table1_004 | table2_003



Table2
--------------------------------------------------------
Table2_Number | Table2_Text
(short string) | (mulitline_string)
--------------------------------------------------------
table2_001 | table1_001, table1_002, table1_003
table2_002 | table1_001, table1_003
table2_003 | table1_003, table1_004
table2_004 |
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top