Link to home
Start Free TrialLog in
Avatar of sushmasriram
sushmasriram

asked on

application error R0002

The following is my powerscript code for a window that generates a report and a graph. I am getting an application error "Null object reference line 11 of w_downtime_reason R0002.



integer      row_count, li_downtime
date            ldt_begin_date, ldt_end_date, temp_date
string      machine_num, setting
st_date_machine      st_date_machine
open( w_calendar_range_response_mach )
st_date_machine = message.powerobjectparm
      tab_1.tabpage_1.dw_1.settransobject( sqlca )
      tab_1.tabpage_1.dw_1.retrieve( ldt_begin_date, ldt_end_date, machine_num, row_count )
      tab_1.tabpage_2.dw_2.settransobject( sqlca )
      tab_1.tabpage_2.dw_2.retrieve( ldt_begin_date, ldt_end_date, machine_num )
ldt_begin_date = st_date_machine.st_begin_date
ldt_end_date = st_date_machine.st_end_date
machine_num = st_date_machine.st_machine_id
if machine_num <> '-1' then
      if ldt_begin_date > 1949-01-01 and ldt_end_date > 1949-01-01 then
      temp_date = ldt_begin_date
      do while temp_date <= ldt_end_date
      select sum(downtime_minutes)  
    into :li_downtime  
    from machine_downtime  
   where ( machine_id = :machine_num ) and  
         ( capture_date = :temp_date );
                  
                  if li_downtime > 10 then
                        row_count++
                  end if

            temp_date =relativedate(temp_date,1)      
      loop      
      
      if ldt_begin_date = ldt_end_date then
            tab_1.tabpage_2.dw_2.object.gr_1.title = machine_num + 'Downtime Category Report between' + string( ldt_begin_date, 'mm-dd-yyyy')
      else
            tab_1.tabpage_2.dw_2.object.gr_1.title = machine_num + 'Downtime Category Report ' + string( ldt_begin_date, 'mm-dd-yyyy') + ' and ' + string( ldt_end_date, 'mm-dd-yyyy')
      end if
      
else
      
end if


            
            
end if

I am unable to figure out what the error is

Thanks
Sushma
Avatar of tr1l0b1t
tr1l0b1t

Hi,

Change the name of the variable "st_date_machine" (it has the same name that its classname)
and check if the returned value from popup window is valid :

[...]
st_date_machine    lst_date_machine
open( w_calendar_range_response_mach )
open( w_calendar_range_response_mach )
If IsValid(Message.PowerObjectParm) and Not IsNull(Message.PowerObjectParm) Then
      If ClassName(Message.PowerObjectParm) = 'st_date_machine' Then
            lst_date_machine = message.powerobjectparm
      Else
            MessageBox("Error","Returned object is not valid")
            Return -1
      End If
Else
      MessageBox("Error","Nothing Returned")
      Return -1
End If

// Then, assign values ...
ldt_begin_date = lst_date_machine.st_begin_date
ldt_end_date = lst_date_machine.st_end_date

Hope it helps
Regards
Sorry, just one "open( w_calendar_range_response_mach )" is needed !! o:)
Avatar of sushmasriram

ASKER

It helped thank you
ASKER CERTIFIED SOLUTION
Avatar of diasroshan
diasroshan
Flag of Kuwait image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks :?
Hi,

sushma, looks like u did a big goof up here... the points were most deservingly for tr1l0b1t ...

he needs to be awarded the points... im sure its an error here...

sushma can u request the Page Editor to transfer the points to tr1l0b1t ...

Also,
tr1l0b1t  u have any suggestion how this can b brought about... these points are absolutely not mine... i cant have it... please find a solution and post here...

Cheers,
Rosh
I guess that sushma (if agree) might post the request, not me.
Anyway, thanks for your comments rosh !