?
Solved

In calling displaygrouptree in powerbuilder script, I receive an error "Error Accessing external object property displaygrouptree at line 96 "

Posted on 2007-10-11
10
Medium Priority
?
1,210 Views
Last Modified: 2013-12-26
I am new to powerbuilder. At present, I am trying to access a crystal report from a powerbuilder script. I receive the error message "Error Accessing external object property displaygrouptree at line 96 "

                      ole_viewer.object.displaygrouptree = FALSE
      ole_viewer.object.EnableExportButton = TRUE      
      ole_viewer.object.reportsource = oleReport
      ole_viewer.object.viewreport()
Any of the above statements will cause this same error.
0
Comment
Question by:sagojr
  • 5
  • 3
  • 2
10 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 20059494
Try taking the .object out

 ole_viewer.displaygrouptree = FALSE
 ole_viewer.EnableExportButton = TRUE      
 ole_viewer.reportsource = oleReport
 ole_viewer.viewreport()

mlmcc
0
 

Author Comment

by:sagojr
ID: 20060288
I tried removing the "object" and recieved a syntax error.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 20060532
Does powerbuilder auto fill when you type object?

DOes it show DisplayGroupTree or something similar?

There is also an EnableGroupTree property.  It may have to be set TRUE first

mlmcc
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:sagojr
ID: 20060832
Powerbuilder does not show DisplayGroupTree or something similar. However, it accepts the syntax and allows me to run the program.
0
 
LVL 5

Expert Comment

by:berXpert
ID: 20065956
Powerbuilder can't verify the attributes of an OLE object until runtime.

Can you post how are you connecting to Crystal reports, probably you are accessing a NULL object.

Pleas try this sample code and let us know if the same error appear at EnablePrintButton.


OLEObject g_ole_crx_application
OLEObject g_ole_crx_report
Integer li

li = g_ole_crx_application.ConnectToNewObject('CrystalRuntime.Application.9')

if li < 0 then
      MessageBox("Error", "Did not connect to Crystal Application Object")
      return
end if

g_ole_crx_report = g_ole_crx_application.OpenReport("my_report.rpt", 1)

//ole_crviewer was placed in your window
ole_crviewer.object.ReportSource(g_ole_crx_application )
ole_crviewer.object.EnablePrintButton = True
ole_crviewer.object.ViewReport


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

Regards,

BerX
0
 

Author Comment

by:sagojr
ID: 20066667
I received the same message. (Error Accessing external object ...) Here is my code:

long       lRet
string       l_docname
oleobject       oleCrystal
oleobject      oleReport

oleCrystal  = CREATE oleobject
oleReport  = CREATE oleobject

lRet    = oleCrystal.ConnectToNewObject('CrystalRuntime.Application.11')

// You'll want to check that Ret = 0 (NO ERROR THERE)

If lRet <> 0 Then
      MessageBox('Crystal Runtime Alert', 'There was a problem connecting to a Crystal component.')
      Post Close(this)
      Return 1
End If

l_docname = as_path_file

//just for testing the process
If Len(Trim(l_docname)) = 0 Then
      MessageBox('Process Alert', 'There was no report to open or it could not be found.  Please check that the Crystal Report Path has been set.')
      Post Close(this)
      Return 1
End If
oleReport    = oleCrystal.openreport(l_docname, 1)

      
oleReport.MorePrintEngineErrorMessages = TRUE
oleReport.FieldMappingType = 1
oleReport.UseIndexForSpeed = TRUE
oleReport.CaseInsensitiveSQLdata = False
oleReport.VerifyOnEveryPrint = TRUE

oleReport.DiscardSavedData()

//SET LOCATION ON ALL REPORT TABLES
 
SetLocation (olereport)

//  Now we run through the report areas/sections and find any sub reports
//   We will manipulate the logon info for them as well.

  oleobject oleRptArea, oleRptSection, oleRptObj, oleSubRpt
  long            ll_ra, ll_ro, ll_rs
 
  For ll_RA = 1 to oleReport.Areas.Count
        oleRptArea = oleReport.Areas.Item(ll_RA)
      
    For ll_RS = 1 to oleRptArea.Sections.Count
            oleRptSection = oleRptArea.Sections.Item(ll_RS)
            
      For ll_RO = 1 to oleRptSection.ReportObjects.Count
            oleRptObj = oleRptSection.ReportObjects.Item(ll_RO)
            
        If oleRptObj.Kind = 5 Then
            oleSubRpt = oleRptObj.OpenSubReport
              SetLocation(oleSubRpt)
              // Call SetParameterFields(oSubRpt,oRptDefinition,oRptUserDetail,oRptPreferences,True)
             // Call SetFormulaFields(oSubRpt,oRptDefinition,oRptUserDetail,oRptPreferences)
        End If
             
      Next
            
    Next
      
    //set global indicating if the report contains grouped data.
    //This will be used for the default viewer configuration.
    //If oRptArea.Kind = 5 Or oRptArea.Kind = crLineObject Then
    //  show tree on left
    //End If
  Next

in_crystal_rpt.of_report_options_c9(oleReport)

If in_crystal_rpt.ib_printreport Then
      oleReport.PrintOut(false)
      Close(this)
Else
      ole_viewer.object.displaygrouptree = FALSE
      ole_viewer.object.EnableExportButton = TRUE
      //ole_viewer is the new report viewer visual OCX object ...            
      ole_viewer.object.reportsource = oleReport
      ole_viewer.object.viewreport()      
End If

Return 1
0
 
LVL 5

Expert Comment

by:berXpert
ID: 20067174
Can you try to move the assignment after the ReportSource,

Else
      //ole_viewer is the new report viewer visual OCX object ...            
      ole_viewer.object.reportsource = oleReport
      ole_viewer.object.displaygrouptree = FALSE
      ole_viewer.object.EnableExportButton = TRUE
      ole_viewer.object.viewreport()      
End If

I'm not sure but ReportSource should be a function call, so also try this:

Else
      //ole_viewer is the new report viewer visual OCX object ...            
      ole_viewer.object.reportsource ( oleReport )
      ole_viewer.object.displaygrouptree = FALSE
      ole_viewer.object.EnableExportButton = TRUE
      ole_viewer.object.viewreport()      
End If

Finally, try to do the assignments thru function calls

Else
      //ole_viewer is the new report viewer visual OCX object ...            
      ole_viewer.object.reportsource( oleReport )
      ole_viewer.object.displaygrouptree(  FALSE )
      ole_viewer.object.EnableExportButton( TRUE )
      ole_viewer.object.viewreport()      
End If


- BerX
0
 

Author Comment

by:sagojr
ID: 20067561
still sam problem
0
 
LVL 5

Accepted Solution

by:
berXpert earned 1000 total points
ID: 20068184
Let's confirm the propertes you want are present in the Crystal Report version you have.

Please insert a new Crystal Report OLE object in a window.

Insert object window should open. At "Create New" or at "Insert Control" tab click on "Browse..." button
It will open the OLE Object Browser.

Here please confirm displaygrouptree is listed at Properties Node.
Probably the property is containted in other object and you will need to call it like:

ole_viewer.object.CRviewer.displaygrouptree = FALSE


A good test will be to change a property or call a function listed in this OLE Object Browser  within your code.

Try to change a property or a function from the list and include in your code before the actual error.

Let me know what is the result.

BerX
0
 

Author Comment

by:sagojr
ID: 20079495
Good deal. I was able to note that there were no functions present. I reregistered the object and everything works fine. Thanks  
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question