OT: Perl script question

  • From: "M.Godlewski" <mcgodlewski@xxxxxxxxx>
  • To: oracle-l@xxxxxxxxxxxxx
  • Date: Tue, 14 Dec 2004 07:20:53 -0800 (PST)

Newbie Perl dba!
 
There is a perl program left by a previous employee which I'm trying to 
understand.  Below are some pieces of the program.  Basically it throws up a 
screen and asks for selected records 1-5.  If 2 is picked it runs the following 
code.   I'm trying to figure out how to pull all records back instead of just a 
$user_list entered.  Can I use a special character for the $user_list to pull 
all records back that are of user_rec_type=2?
 
If I need to post the whole program let me know.  
 
TIA
 
User_rec_type = 2
 
# Build basic query for user's selected record type
my $querydef = $session -> BuildQuery($rec_type);
$querydef -> BuildField("id");
$querydef -> BuildField("state");
$querydef -> BuildField("owner");
my $resultset = $session -> BuildResultSet($querydef);
$resultset -> Execute();
# Traverse query results, checking for user's reporting criteria, i.e. record 
list
while (($resultset -> MoveNext()) == 1) {
  $id=$resultset->GetColumnValue(1);
  $state=$resultset->GetColumnValue(2);
  $owner=$resultset->GetColumnValue(3);
  for ($j=1; $j <= $i; $j++) {
     if (($list[$j] eq $id) or ($list[$j] eq $owner) or ($list[$j] eq $state)) {
 
    if ($user_rec_type eq 2) {
     $rec=$session->GetEntity($rec_type,$id);
     $head=$rec->GetFieldValue("Headline")->GetValue();
     $description=$rec->GetFieldValue("Description")->GetValue();
     $sev=$rec->GetFieldValue("Severity")->GetValue();
     $pri=$rec->GetFieldValue("Priority")->GetValue();
     $sub_date=$rec->GetFieldValue("Submit_Date")->GetValue();
     $submitter=$rec->GetFieldValue("Submitter")->GetValue();
     $est_staff_hours=$rec->GetFieldValue("Estimated_Staff_Hours")->GetValue();
     
$est_completion_date=$rec->GetFieldValue("Estimated_Completion_Date")->GetValue();
     $impact_analysis=$rec->GetFieldValue("Impact_Analysis_Data")->GetValue();
     $scr_cross=$rec->GetFieldValue("SCR_Cross_Ref")->GetValue();
     $resolution=$rec->GetFieldValue("Resolution")->GetValue();
     $notes=$rec->GetFieldValue("Notes_Log")->GetValue();
     print OUT1 "\n$rec_type $id\n\n";
     print OUT1 wrap("","",$head);
     print OUT1 "\n\n";
     print OUT1 "State:           $state \n";
     print OUT1 "Severity:        $sev\n";
     print OUT1 "Priority:        $pri\n";
     print OUT1 "Resolution:      $resolution \n";
     print OUT1 "SCR Cross Ref:   $scr_cross\n";
     print OUT1 "Owner:           $owner \n";
     print OUT1 "Submit Date:     $sub_date \n";
     print OUT1 "Submitter:       $submitter\n\n";
     print OUT1 "Description: \n\n";
     print OUT1 wrap("","",$description);
     print OUT1 "\n\n";
     print OUT1 "Impact Analysis Data: \n\n";
     print OUT1 wrap("","",$impact_analysis);
     print OUT1 "\n\n";
     print OUT1 "Est. Staff Hours:       $est_staff_hours\n";
     print OUT1 "Est. Completion date:   $est_completion_date\n\n";
     print OUT1 "Notes Log: \n";
     print OUT1 wrap("","",$notes);
     print OUT1 "\n";
     print OUT1 
"\n---------------------------------------------------------------------------------\n";
     }

sub pad_user_list{
# Parse user's comma-separated record list & pad numbers with epme0000...
$i=0;
$done="F";
while ($done eq "F") {
   $i=$i+1;
   $list[$i]=$user_list;
   $done="T";
   if (index($user_list,",") > -1) {
      $done="F";
      $list[$i]=substr($user_list,0,index($user_list,","));
      $user_list=substr($user_list,index($user_list,",")+1,1000);
   }
   if ($list[$i] =~ /[0123456789]/ ) {$list[$i]=sprintf("epme%08d",$list[$i]);}
}
}

                
---------------------------------
Do you Yahoo!?
 Yahoo! Mail - 250MB free storage. Do more. Manage less.

--
//www.freelists.org/webpage/oracle-l

Other related posts:

  • » OT: Perl script question