I have a need to export a window to PDF that displays a report created
in Infomaker. I have looked through the help files and internet until
my eyes are shot, but can't find what I am looking for. I will not be
able to have a print/export/etc... button on the report window itself,
so it will have to reference the report window from another one.
Hopefully this will make things clearer:
Report window name: w_rpt_moreinfo
The report name: rpt_order_sheet
I need to somehow in powerscript export this report out to a PDF. At
some point I would also like to give the PDF a name based on values
from another window, but that is a different email for a different
time.
Thanks for any help.
"dpinion" <dpi...@gmail.com> wrote in message
news:6a43fada-5b5c-4dcc...@z27g2000prd.googlegroups.com...
Agreed, and I have been trying to use it. However I don't know how to
tell the saveAs function to save the report window mentioned above. I
don't know the conventions to get at the report to export it.
Thanks
"dpinion" <dpi...@gmail.com> wrote in message
news:ef51603e-f302-442b...@h41g2000yqn.googlegroups.com...
I have used the saveas command for other situations. The difference
here is that I cannot place the command button on the window that
contains the report. I need to be able to reference that window (and
more specifically the report it contains) from another window, but I
cannot seem to find syntax to allow me to do so.
If for some reason you can't say "please" and must reach across the table
and grab the data, I would expect w_reportwindow.dw_report.SaveAs(PDF!,
'c:\reports\mypdf.pdf') to work - of course *I* have never tried to do it
that way <G>
"dpinion" <dpi...@gmail.com> wrote in message
news:732e1d0e-9340-456a...@m16g2000vbp.googlegroups.com...
Thanks Jerry,
I will give those a try. A bit more information. The program itself is
not mine, but a CRM package my company bought that was created with
powerbuilder. They have given us the ability to create our own scripts
and add features, but any scripts are only available using their pre-
defined functions. For example:
gf_buttonprocessuser: Allows us to use the TAG property of a command
button to run script within this function (uses CASE statements that
match the TAG property you set for the button). However, I don't have
access to windows, only datawindows. So I place a button on a
datawindow, give it a TAG, and then add a CASE statement for that TAG
in the function and add my code.
I hope this makes sense. I must say I really like powerbuilder and
have used it for creating apps for my company since we started using
it for the CRM development. I am still pretty new to the world of
coding, but since I had VBA experience they thought I was good
enough.. ;0)
On Jan 12, 9:50 am, "Jerry Siegel [TeamSybase]"
<jNOsSPAMsiegel@yahoo!.com> wrote:
> PB creates a global variable with same name as the window. It's good OO to
> put the method that handles the data owned by the window within that window.
> Your code would look like
> IF IsValid (w_reportwindow) THEN
> w_reportwindow.wf_makepdf ('c:\reports\mypdf.pdf')
> END IF
***
Here is the code I came up with. When ran it does not find the window:
window w_rpt_moreinfo
datawindow dw_report
IF IsValid (w_rpt_moreinfo) = True THEN
Messagebox("It's there!", "I see your window, w_rpt_moreinfo!")
else
messagebox("Nope", "don't see it")
END IF
Also I could not find anything on wf_makepdf. Is that an actual
function?
***
>
> If for some reason you can't say "please" and must reach across the table
> and grab the data, I would expect w_reportwindow.dw_report.SaveAs(PDF!,
> 'c:\reports\mypdf.pdf') to work - of course *I* have never tried to do it
> that way <G>
***
and I tried this:
w_rpt_moreinfo.dw_report.SaveAs(PDF!,'c:\reports\mypdf.pdf')
but got an error:
"Incompatible property dw_report for type Window"
***
>
"dpinion" <dpi...@gmail.com> wrote in message
news:9725077a-9cf9-41d4...@a12g2000pro.googlegroups.com...
On Jan 12, 11:45 am, "Jerry Siegel [TeamSybase]"
<jNOsSPAMsiegel@yahoo!.com> wrote:
> Do not declare w_rpt_moreinfo, it will be local to your script and hide the
> global variable that PB created.
***
If I do not declare it, I get a "Undefined variable" error in
Powerbuilder, and it will not compile/save.
***
> wf_makepdf is a function you would have added to the window if you could
> have.
I see.. :)
> Likewise with dw_report - you will need to know what the DW control in
> w_rpt_moreinfo is called and refer to it directly. Very easy if you have the
> source, otherwise try the PB object browser.
>
***
I believe the control is dw_report in this case. We have the ability
to click on a portion of the window, and it will tell us the window
name, the datawindow name it contains, what library it is from as well
as the window's ancestor. And I still don't know how I might be able
to refer to it directly from another window, as I cannot seem to
include the window name in the dot notation.(?)
"dpinion" <dpi...@gmail.com> wrote in message
news:aa35e3f3-a1f7-4943...@f33g2000vbf.googlegroups.com...
I am adding the code through their supplied function and calling it
using the button's Tag. I can make my own app and place everything on
the same window and have it work fine. I just cannot seem to use a
button on a datawindow on a window within their app to reference the
report's window (where the is no option to place a button) and have it
save the PDF.
Unfortunately the application is a bit older and they have now went to
a .net framework. So no upgrade support (to the existing CRM) or an
expensive CRM upgrade.
"dpinion" <dpi...@gmail.com> wrote in message
news:6ff2d89c-888d-4af8...@i24g2000prf.googlegroups.com...
Hey Jerry,
Thanks for your willingness to help me! I don't know if this will
help, but below is example code showing how the gf_buttonprocessuser
function works, and what variables are passed to it. (hopefully the
formatting will keep here)
gf_dwbuttonprocess_user()
Description:
Called when a user clicks a button placed on a datawindow. (See
PowerBuilder event ButtonClicked in the next appendix.) When placing a
custom button on a datawindow, have the related code execute.
Syntax: gf_dwbuttonprocess_user(adw, astng)
Argument Description
adw Datawindow by reference; the datawindow containing
the button.
astag String by value; tag value from calling datawindow
button.
Return Value
None
Example
This gf_dwprocessbutton_user function calls another report from a
report in More Information.
[Start Code]
string lsType
integer liCount
string lsWindow, lsDetailDW
if adw.AcceptText() = -1 then return
string lsaParms[]
// get number of arguments
liCount = gf_dwbuttonparsetag(astag,lsaParms)
if liCount <= 0 then return
lsType = lsaParms[1]
choose case Upper(lsType) <-- This is where the TAG for the button
comes into play in order to execute the code below
case 'MOREINFO'
// mc 12/8/00 Caveat: the retrieval argument for the more info
datawindow
// will be the first column in the SQL
// in the *calling* datawindow, where the button is.
// 1 2 3 4
// e.g. moreinfo:w_rpt_moreinfo:tr_cust_snapshot:row
// Arguments:
// 1 - moreinfo
// 2 - window name (w_rpt_moreinfo)
// 3 - datawindow name (e.g. tr_cust_snapshot)
// 5 - row (auto-appended)
if liCount < 4 then return // valid number of arguments?
lsWindow = lsaParms[2]
lsDetailDW = lsaParms[3]
if not w_desktop.wf_security_chk(lsWindow, 'init') then return
gstrmoreinfo.dwname = lsDetailDW
lstrView.datawindow = adw
w_desktop.wf_RequestOpen(lsWindow, string(Now(), 'h:mm:ss:ffffff'))
end choose
[End Code]
I don't know if this helps, and I may be fighting a lost cause on this
one, but I do appreciate your help.
CASE 'SavePDF'
adw.SaveAs ('',PDF!)
Give that a try and let me know if it works
"dpinion" <dpi...@gmail.com> wrote in message
news:a55cede8-1197-4e6e...@20g2000yqt.googlegroups.com...
Hey Jerry,
For some reason I can't save it using PDF!, but text and Excel work
fine. It isn't quite what I need though, as that will save the values
in the *current* datawindow, where I need to be able to save a
different window from the command button event. Looking over the code
above again, I got to wondering. See my questions below in the code:
// Arguments:
// 1 - moreinfo
// 2 - window name (w_rpt_moreinfo) ******* Is it possible to use
this? This is the name of the window I need, however it is currently
brought in as a string
// 3 - datawindow name (e.g. rpt_order_sheet) *******Same with this,
except it is the name of the actual report I need.
// 5 - row (auto-appended)
if liCount < 4 then return // valid number of arguments?
lsWindow = lsaParms[2]
lsDetailDW = lsaParms[3]
if not w_desktop.wf_security_chk(lsWindow, 'init') then return
gstrmoreinfo.dwname = lsDetailDW
lstrView.datawindow = adw
w_desktop.wf_RequestOpen(lsWindow, string(Now(), 'h:mm:ss:ffffff'))
******* So instead of opening the window (it will already be open),
could I use "lsWindow" and "lsDetailDW" to plug the values for the
window and report into the saveas function?
end choose
On Jan 13, 10:45 am, dpinion <dpin...@gmail.com> wrote:
> On Jan 13, 9:29 am, "Jerry Siegel [TeamSybase]"
>
> <jNOsSPAMsiegel@yahoo!.com> wrote:
> > The clue I'm seeing here is
> > adw Datawindow by reference; the datawindow containing the
> > button.
> > So you can call a method in the DW without caring whatwindowit's in. I
> > think you could pass the file name for the PDF in the tag, but I would
> > probably omit it from the SaveAs call and have the function ask for a file
> > name so that the user could keep different versions. The tag would just be
> > SavePDF, then
>
> > CASE 'SavePDF'
> > adw.SaveAs ('',PDF!)
>
> > Give that a try and let me know if it works
>
> Hey Jerry,
> For some reason I can't save it using PDF!, but text and Excel work
> fine. It isn't quite what I need though, as that will save the values
> in the *current* datawindow, where I need to be able to save a
> differentwindowfrom the command button event. Looking over the code
> above again, I got to wondering. See my questions below in the code:
>
> // Arguments:
> // 1 - moreinfo
> // 2 -windowname (w_rpt_moreinfo) ******* Is it possible to use
> this? This is the name of thewindowI need, however it is currently
> brought in as a string
>
> // 3 - datawindow name (e.g. rpt_order_sheet) *******Same with this,
> except it is the name of the actual report I need.
> // 5 - row (auto-appended)
>
> if liCount < 4 then return // valid number of arguments?
>
> lsWindow = lsaParms[2]
> lsDetailDW = lsaParms[3]
>
> if not w_desktop.wf_security_chk(lsWindow, 'init') then return
>
> gstrmoreinfo.dwname = lsDetailDW
> lstrView.datawindow = adw
> w_desktop.wf_RequestOpen(lsWindow, string(Now(), 'h:mm:ss:ffffff'))
> ******* So instead of opening thewindow(it will already be open),
> could I use "lsWindow" and "lsDetailDW" to plug the values for thewindowand report into the saveas function?
>
> end choose
"dpinion" <dpi...@gmail.com> wrote in message
news:0207d1cd-b798-48e0...@13g2000yql.googlegroups.com...
window lw_parent
powerobject lpo_parent
lpo_parent = adw.getparent()
if lpo_parent.TypeOf() = window! then lw_parent = lpo_parent
then use dynamic to call the function or event on the descendent window.
lw_parent.dynamic <yourwindowfunctioncall>
"dpinion" <dpi...@gmail.com> wrote in message news:0207d1cd-b798-48e0...@13g2000yql.googlegroups.com...