We help IT Professionals succeed at work.

application error R0002

sushmasriram
sushmasriram asked
on
Medium Priority
571 Views
Last Modified: 2013-12-26
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
Comment
Watch Question

Commented:
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

Commented:
Sorry, just one "open( w_calendar_range_response_mach )" is needed !! o:)

Author

Commented:
It helped thank you
Hi,

sushma, u have lotsa questions open and i guess u need to close the ones where uve got ur answer...

atleast here im sure uve got what ur lookin for...

so please award tr1l0b1t the deserving points for his efforts...

Cheers,
Rosh

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Commented:
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

Commented:
I guess that sushma (if agree) might post the request, not me.
Anyway, thanks for your comments rosh !
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.