Login
`
Templates, Tools and Utilities
|
||
Icetips Article
Back to article list
Search Articles
Add Comment
Printer friendly
Direct link
Par2: Print Button - More than one report from one button 1998-12-02 -- Dennis Evans >I want to add one more print button on the browse form, which using the control
>template for print browse button. This is a good tool for printing current browse record.
>But this tool can only add one button on eash browse form.
Hi all,
You really only need one button to print all your reports.
This is how to do it,
Add a button control to the window, not on a tab - we want the button to be
displayed regardless of the tab.
Call the control ?PrintButton or something.
In the Window manager Init method, after the browse is initialized add these two lines.
Brwx.PrintControl = ?PrintButton
Brwx.PrintProcedure = x
Where x is one larger than the number of update procedures. If you have three browses
and three update procedures then x would be equal to 4. I would use some equates
here.
In the control event handling, tab new selection or whereever you want to change
report procedures, if you want to call more than one report add this line
Brwx.PrintProcedure = choice(?CurrentTab)
This property must be set to the sequence number of the report you want to be currently
active. This will be the value passed to the run method for the call to the update or
report procedures.
The property can be set pretty much anywhere based on whatever condition you want.
Now the hard part, in the Window manager Run method use the embed editor rather
than the embed points for this one Change the method to look like this.
ThisWindow.Run PROCEDURE(USHORT Number,BYTE Request)
ReturnValue BYTE,AUTO
! Start of "WindowManager Method Data Section"
! [Priority 5000]
! End of "WindowManager Method Data Section"
CODE
! Start of "WindowManager Method Executable Code Section"
! [Priority 2500]
! Parent Call
ReturnValue =PARENT.Run(Number,Request)
! [Priority 6000]
omit('####')
GlobalRequest = Request
execute Number
NormalUpdateProcedure
AnotherUpdateProcedure
end
ReturnValue = GlobalResponse
! [Priority 8500]
####
The above is the template generated, with two update procedures, copy it and then
omit it out. (Wonderful idea, wish I could take credit. )
Now add these lines
GlobalRequest = Request
execute Number
NormalUpdateProcedure
AnotherUpdateProcedure
Report_1( any parameters )
Report_2( any parameters )
end
ReturnValue = GlobalResponse
! [Priority 8500]
! End of "WindowManager Method Executable Code Section"
RETURN ReturnValue
Now if you want to print one record, you can use the same report to print one record or
all the records or a range.
Add the Extended process control template to the report, and check the single record.
Now add some kind of control or condition to the browse that will allow the user to
decide if they want one record or the all records.
Change the derived Run method to this
GlobalRequest = Request
execute Number
NormalUpdateProcedure
AnotherUpdateProcedure
begin
if Condition = User Wants All Records
GlobalRequest = value <> ProcessRecord
end ! if
Report_1( any parameters )
end ! execute option 3
Report_2( any parameters )
...
end
The report does not care about the value of the request, except if it is equal to the
equate ProcessRecord.
It is a little more fooling around than a template, but with an execute statement and a
couple of if else or a case statement you can call all the reports that are related to the
browse from the screen.
The test conditions can be based on the current tab, sort order, range limit or a user
selection of some kind etc...
This is really simpler than it looks and I think easier than having several buttons
to call different reports.
Today is November 21, 2024, 8:22 am This article has been viewed 35284 times.
|
|