Question : New Perl Spreadsheet Parseexcel problem

For the attached Spreadsheet and the attached code,
it should print out the data contents at the specified location corresponding to the file name. As soon as it hits an END it prints out the content.


I am getting the following error...It was not coming previously..What can be done to remove it?

------------------------------------------------------

ROW : 9
COLUMN: 17
Cell value is P
The first array element is 059L042M6|99*QNDNCA|USD|0302|8759|USD|95|9528.08|928.08|20090507|20091204|059L042M6|OTC4|L|S

Content of '/v/region/na/appl/phoenixfunding/etl/data/qa/SrcFiles/MFOtcTaxlotOpenDelta.txt_20100226' will be:
059L042M6|99*QNDNCA|USD|0302|8759|USD|95|9528.08|928.08|20090507|20091204|059L042M6|OTC4|L|S
059L042M6|99*QNDNCA|USD|0302|8759|USD|85|8528.08|828.08|20090507|20091204|059L042M6|OTC4|S|S
059L042M6|99*QNDNCA|USD|0302|8759|USD|75|7528.08|728.08|20090507|20091204|059L042M6|OTC4|L|P
059L042M6|99*QNDNCA|USD|0302|8759|USD|65|6528.08|628.08|20090507|20091204|059L042M6|OTC4|S|P
059105130|99*QNDNCA|EUR|0302|3275|USD|5000|5190.36|590.36|20090501|20120512|'059105130|OTC4|L|S
059105130|99*QNDNCA|EUR|0302|3275|USD|4000|4190.36|490.36|20090501|20120512|'059105130|OTC4|S|S
059105130|99*QNDNCA|EUR|0302|3275|USD|3500|3190.36|390.36|20090501|20120512|'059105130|OTC4|L|P

Row before if statement is 10
Value of row before calling next is 12
Row before if statement is 12
Can't call method "value" on an undefined value at /ms/user/s/sayantag/Process_MF.pl line 35.

----------------------------------------------------------------
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
#!/usr/bin/perl5.10 -w


use warnings;
use Spreadsheet::ParseExcel;
use strict;
use IO::Scalar;
use Data::Dumper;

my @etl_val = @ARGV;

print "@etl_val" . "\n" ;

my $parser   = Spreadsheet::ParseExcel->new();
my $workbook = $parser->parse("/ms/user/s/sayantag/Demo_MF5.xls");
my $worksheet;
my %order_of_flat_file;
my @data_arr;
my $etl;
my $path;

for  $worksheet ( $workbook->worksheets() ) {
   my ( $row_min, $row_max ) = $worksheet->row_range();
   my ( $col_min, $col_max ) = $worksheet->col_range();
 
   my $row = $row_min + 2;
   while( $row <=$row_max ) {
        print "Row before if statement is $row\n";    
     if ($worksheet->get_cell( $row, 2 )->value ne "END") {
        print "Row after if statement is $row\n";
                
     my $etl_cell  = $worksheet->get_cell( $row, 2 );
        if(defined($etl_cell)) {
        $etl = $etl_cell->value;}

     my $path_cell = $worksheet->get_cell( $row, 1 );
        if(defined($path_cell)) {
        $path = $path_cell->value;
        $path =~ s/\s$//;
        print "PATH: $path" . "\n";}

     my $path_cell0 = $worksheet->get_cell( $row, 0 );
        if(defined($path_cell0)) {
        $path.= $path_cell0->value;
        print $path_cell0->value . "\n";
        print "PATH: $path" . "\n";
        print "ETL: $etl" . "\n";
        print "PATH: $path" . "\n";
        
        }
     my $data_row; 
     for my $col ( $col_min+3 .. $col_max ) {
        print "ROW : $row" ."\n";
        print "COLUMN: $col" . "\n";
                
        my $cell = $worksheet->get_cell( $row, $col );
        if (defined($cell) ) {
          my $cell_val = $cell->value;
          print "Cell value is $cell_val\n";
          $data_row .= $cell_val.'|';
         print "The first array element is $data_arr[0]\n";
          print "Content of '", $path, "' will be:\n", @data_arr, "\n";
         } else {$data_row .= '|';
                 
                } 
         
         }
        $data_row =~ s{\|+$}{}; # Remove trailing pipes.
        $data_row .= "\n"; # Add line end to end of row. 
        push @data_arr, $data_row;  
        $row++;     
       }
        else {# print "The array looks like @data_arr\n";
              open("FILEHANDLE", '>', $path) or die "Cannot open the file ", $path, ": $!";
              print FILEHANDLE @data_arr ;
              close ("FILEHANDLE");
              @data_arr = ();
              $row = $row+2;
              print "Value of row before calling next is $row\n";
              next;
      
            }
        $order_of_flat_file{$etl} = $path;
     }
   }

for my $curr_etl_val( @etl_val ){
        print $order_of_flat_file{$curr_etl_val}, "\n";
}

foreach my $curr_etl (@etl_val) {
print "\nNow executing workflow $curr_etl\n";
`ksh Command_Line_Etl.ksh "PhoenixFundingAdmin" "NjuX2mfP0k" "PhoenixFunding" $curr_etl "REPO_SVC_PhxR2Qa" "Domain_NY_Qa"`;
}
print "\nAll files are generated after running the workflows. Plot these files as well as the baseline files to a spreadsheet by running the Excel Setup script before Data Compare through Saturn\n\n\n";
Attachments:
 
Attached spreadsheet
 

Answer : New Perl Spreadsheet Parseexcel problem

Usually if an application works when you connect to a 'full desktop' using RDP but NOT when as a RemoteApp, the issue is normally the fact the shell is now the app executable and NOT Explorer.exe. Very common issue with Delphi written apps.
The other issue is sometimes an app relies on all parameters from a shortcut to work properly (start in, path, etc). RemoteApp does not use all of them.
What you do in this case is to create a RemoteApp that points to a .LNK file (shortcut) instead of going to the app executable. So create the shortcut and then choose it instead of the .EXE for the app. That fixes many apps as well.

Cláudio Rodrigues
Citrix CTP
Random Solutions  
 
programming4us programming4us