Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how build crystal reports in powerbuilder

980 views
Skip to first unread message

pravin

unread,
Dec 28, 2007, 5:28:46 AM12/28/07
to
Hi,

Please tail me how Build crystal reports in powerbuild

regards
pravin sali


--

Pravin sali
Fem Care Pharma Ltd
0253-6604440


Brad Wery[TeamSybase]

unread,
Jan 3, 2008, 1:47:14 PM1/3/08
to
Do you mean how to integrate it or how to create a report? To integrate
it you would most likely need to put an Crystal Reports OCX control on
your window then call the appropriate function to load the report.
Crystal Reports should have this information documented somewhere. To
create a report you would use the tools that come with Crystal Report.

Brad

Jim Madderra

unread,
Jan 3, 2008, 9:19:27 PM1/3/08
to
What is the secion at the end of code that says: "Start of PowerBuilder
Binary Data Section" ???? Where does this come from?

"Yoyo Young" <yo...@public1.wx.js.cn> wrote in message
news:477d8db4@forums-1-dub...
> You can't import it but you can see souce code in it.
>
> Yoyo
>
> "pravin" <pravi...@femcareindia.com> wrote in message
> news:4774cfde@forums-1-dub...

Yoyo Young

unread,
Jan 6, 2008, 10:10:30 PM1/6/08
to
I didn't find the line you refer.
Following is the export syntax:

forward
global type w_crystalreport from paf_w_base
end type
type ole_crviewer from olecustomcontrol within w_crystalreport
end type
end forward

global type w_crystalreport from paf_w_base
integer width = 2715
integer height = 1928
string title = "Crystal Report Viewer"
event type long ue_postopen ( )
ole_crviewer ole_crviewer
end type
global w_crystalreport w_crystalreport

type variables
OLEObject wi_ole_crx_application // application object
OLEObject wi_ole_crx_report // report object
OLEObject wi_ole_crx_connection_info // database connection properties

String wi_s_selectsql, wi_s_crystalreportdsn, is_file
end variables

forward prototypes
public function integer wf_viewreportbydsn ()
public function integer wf_viewreportbyadoresultset ()
end prototypes

event ue_postopen;call super::ue_postopen;Int li_p, li_p1, li_p2
n_cst_stringservice lnvo_string

// Open the report object
if is_file <> "" then
wi_ole_crx_report = wi_ole_crx_application.OpenReport(is_file)

if wi_s_crystalreportdsn = "" then
wi_s_selectsql = Trim(wi_ole_crx_report.SQLQueryString)

//cut "
lnvo_string = create n_cst_stringservice
wi_s_selectsql = lnvo_string.globalreplace(wi_s_selectsql, '"', '', false)
destroy lnvo_string

//cut table owner
li_p = Pos(wi_s_selectsql, ".dbo.")
do while li_p > 0
li_p1 = LastPos(wi_s_selectsql, " ", li_p)
li_p2 = Pos(wi_s_selectsql, " ", li_p + 1)
if li_p1 > 0 and li_p2 > 0 then
wi_s_selectsql = Replace(wi_s_selectsql, li_p1, li_p2 - li_p1, "")
end if
li_p = Pos(wi_s_selectsql, ".dbo.")
loop

//retrieve report
wf_viewreportbyadoresultset()
else
wf_viewreportbydsn()
end if

//set toolbar button
ole_crviewer.object.EnablePrintButton = false
ole_crviewer.object.EnableExportButton = true
ole_crviewer.object.EnableSearchExpertButton = true
ole_crviewer.object.EnableSelectExpertButton = true

if g_s_usertype = "R" then
ole_crviewer.object.EnableHelpButton = true
end if
end if

return 1
end event

public function integer wf_viewreportbydsn ();String ls_password, ls_user

// Set connection_info to Report ConnectionProperties
wi_ole_crx_connection_info =
wi_ole_crx_report.database.tables[1].ConnectionProperties

// Delete old connections
wi_ole_crx_connection_info.deleteAll

// Add new connection
wi_ole_crx_connection_info.add("DSN", wi_s_crystalreportdsn)

//RegistryGet(gnv_app.of_GetRegistryPath() + "DataSources\" + is_transaction
+ "\","userid", RegString!, ls_user)
//RegistryGet(gnv_app.of_GetRegistryPath() + "DataSources\" + is_transaction
+ "\","password", RegString!, ls_password)
wi_ole_crx_connection_info.add("User ID", ls_user)
wi_ole_crx_connection_info.add("Password", ls_password)

// Verify the database.
wi_ole_crx_report.database.Verify

// Set the report object parameter field by index number
//iole_crx_report.ParameterFields[1].AddCurrentValue(3)
// or use the GetItemByName property to pass the parameter
//wi_ole_crx_report.ParameterFields.GetItemByName("Employee
ID").AddCurrentValue(7)
//wi_ole_crx_report.EnableParameterPrompting = False

// pass report to the viewer
ole_crviewer.object.ReportSource(wi_ole_crx_report)

// view report
ole_crviewer.object.ViewReport

return 1

end function

public function integer wf_viewreportbyadoresultset ();Resultset
lrs_resultset
ADOresultset lrs_ADOresultset
OLEObject loo_ADOrecordset
Long ll_rc
n_Datastore lds_temp
n_cst_helperservice lnvo_helper

lds_temp = create n_datastore

lnvo_helper = create n_cst_helperservice
ll_rc = lnvo_helper.datastorefromsql(wi_s_selectsql, lds_temp, 1)
destroy lnvo_helper

if ll_rc <= 0 then
destroy lds_temp
return -1
end if

ll_rc = lds_temp.GenerateResultSet(lrs_resultset)
if ll_rc <> 1 then
destroy lds_temp
return -1 // report error and return
end if

lrs_ADOresultset = create ADOResultSet
ll_rc = lrs_ADOresultset.SetResultSet(lrs_resultset)
loo_ADOrecordset = create OLEObject
ll_rc = lrs_ADOresultset.GetRecordSet(loo_ADOrecordset)

wi_ole_crx_report.database.SetDataSource(loo_ADOrecordset, 3, 1)

destroy lds_temp

// pass report to the viewer
ole_crviewer.object.ReportSource(wi_ole_crx_report)

// view report
ole_crviewer.object.ViewReport

return 1
end function

on w_crystalreport.create
int iCurrent
call super::create
this.ole_crviewer=create ole_crviewer
iCurrent=UpperBound(this.Control)
this.Control[iCurrent+1]=this.ole_crviewer
end on

on w_crystalreport.destroy
call super::destroy
destroy(this.ole_crviewer)
end on

event resize;call super::resize;ole_crviewer.Move(0, 0)
ole_crviewer.Resize(newwidth, newheight)
end event

event open;call super::open;this.Event Trigger ue_preopen()

this.Event Post ue_postopen()

return 0
end event

event close;call super::close;if IsValid(wi_ole_crx_application) then
wi_ole_crx_application.DisconnectObject()
destroy wi_ole_crx_application
end if
end event

event ue_print;call super::ue_print;ole_crviewer.object.PrintReport()

return 1
end event

event ue_preopen;call super::ue_preopen;String ls_file
Long ll_row, ll_ret

for ll_row = 1 to UpperBound(wi_nvo_resource.ui_s_resourcedirectory)
ls_file = wi_nvo_resource.ui_s_resourcedirectory[ll_row] + "\" +
wi_s_curprgcode + ".rpt"
if FileExists(ls_file) then
is_file = ls_file
exit
end if
next

//RegistryGet(gnv_app.of_GetRegistryPath() + "DataSources\" + is_transaction
+ "\","crystalreportdsn", RegString!, wi_s_crystalreportdsn)
// create OLE object
wi_ole_crx_application = CREATE OLEObject

// connect to Application
ll_ret =
wi_ole_crx_application.ConnectToNewObject('CrystalRuntime.Application.11')
if ll_ret < 0 then
MessageBox("Error", "Can't connect to Crystal Application Object")
end if

end event

type ole_crviewer from olecustomcontrol within w_crystalreport
event closebuttonclicked ( ref boolean usedefault )
event firstpagebuttonclicked ( ref boolean usedefault )
event lastpagebuttonclicked ( ref boolean usedefault )
event prevpagebuttonclicked ( ref boolean usedefault )
event nextpagebuttonclicked ( ref boolean usedefault )
event gotopagenclicked ( ref boolean usedefault, integer pagenumber )
event stopbuttonclicked ( integer loadingtype, ref boolean usedefault )
event refreshbuttonclicked ( ref boolean usedefault )
event printbuttonclicked ( ref boolean usedefault )
event grouptreebuttonclicked ( boolean ocx_visible )
event zoomlevelchanged ( integer zoomlevel )
event searchbuttonclicked ( string searchtext, ref boolean usedefault )
event drillongroup ( any groupnamelist, integer drilltype, ref boolean
usedefault )
event showgroup ( any groupnamelist, ref boolean usedefault )
event selectionformulabuttonclicked ( ref string selctionformula, ref
boolean usedefault )
event selectionformulabuilt ( string selctionformula, ref boolean
usedefault )
event ocx_clicked ( long ocx_x, long ocx_y, any eventinfo, ref boolean
usedefault )
event dblclicked ( long ocx_x, long ocx_y, any eventinfo, ref boolean
usedefault )
event downloadstarted ( integer loadingtype )
event downloadfinished ( integer loadingtype )
event viewchanging ( long oldviewindex, long newviewindex )
event viewchanged ( long oldviewindex, long newviewindex )
event onreportsourceerror ( string errormsg, long errorcode, ref boolean
usedefault )
event exportbuttonclicked ( ref boolean usedefault )
event searchexpertbuttonclicked ( ref boolean usedefault )
event drillongraph ( long pagenumber, long ocx_x, long ocx_y, ref boolean
usedefault )
event drillonsubreport ( any groupnamelist, string subreportname, string
title, long pagenumber, long index, ref boolean usedefault )
event helpbuttonclicked ( )
event focuschanged ( boolean hasfocus )
event oncontextmenu ( any objectdescription, long ocx_x, long ocx_y, ref
boolean usedefault )
event onchangeobjectrect ( any objectdescription, long ocx_x, long ocx_y,
long ocx_width, long ocx_height )
event onlaunchhyperlink ( ref string hyperlink, ref boolean usedefault )
event viewclosed ( long viewindex )
integer width = 1317
integer height = 768
integer taborder = 10
borderstyle borderstyle = stylelowered!
boolean focusrectangle = false
string binarykey = "w_crystalreport.win"
integer textsize = -12
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Tahoma"
long textcolor = 33554432
end type

event refreshbuttonclicked(ref boolean usedefault);if wi_s_crystalreportdsn
= "" then
//don't use default refresh action
usedefault = false

wf_viewreportbyadoresultset()
end if

end event

event helpbuttonclicked();//open report designer

n_cst_shell lnvo_shell

if is_file <> "" then
lnvo_shell.of_initialize()
lnvo_shell.of_open(is_file)
end if
end event


"Jim Madderra" <jmad...@astound.net> wrote in message
news:477d97af$1@forums-1-dub...

Andrew Giulinn

unread,
Jan 6, 2008, 10:43:51 PM1/6/08
to
It is at the bottom of the .srw file that you attached.

"Yoyo Young" <yo...@public1.wx.js.cn> wrote in message

news:47819826@forums-1-dub...

Yoyo Young

unread,
Jan 7, 2008, 12:27:27 AM1/7/08
to
Oh, I see it.
It is what PB11.1 Export.
Maybe it's for crystalreport ole container.

Yoyo

"Andrew Giulinn" <NO.osc...@NOSPAM.dsa.com.au> wrote in message
news:47819ff7@forums-1-dub...

washingt...@gmail.com

unread,
Oct 3, 2012, 12:46:25 PM10/3/12
to
Hello All,
I'm also trying to run a Crystal Report from a PB 11.1 application. I cannot seem to find what OCX control to include. Does anyone have any ideas on this?

Thank you.

Larry

bruce.a...@yahoo.com

unread,
Oct 4, 2012, 2:05:58 PM10/4/12
to
This group has been marked read only on the Sybase server. In addition, the feed between Google and the Sybase server is not currently working. If you post through Google the post will never show up on the Sybase server, and most people who answer questions in that group will never see it. Instead, you may want to access the Sybase newsgroups directly at:

http://www.sybase.com/detail_list?id=11507&pageNum=1&multi=true&show=1248

f.edd...@gmail.com

unread,
Jun 24, 2013, 9:51:54 AM6/24/13
to
Le vendredi 28 décembre 2007 11:28:46 UTC+1, pravin a écrit :
> Hi,
>
> Please tail me with a demo how to migrate reports from powerbuilder 12.5 to crystal report
>
> regards
>Fatima
>
>
> --


0 new messages