Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting the Filter for a Report from ObjectPal 2

Status
Not open for further replies.

ommdennis

Programmer
Jan 27, 2006
2
US
hi,

In Pdox5.0 windows you can set a filter on a specific field
before ypu print a report. ie. on an order entry report I can filter on Orderno so that I only print an invoice for
that particular customer order. My orders table can have
many orders waiting to be processed.


I cannot seem to find a way to print the invoice for just that order/customer during the order entry program. Is their a way to pass the order number to the report so that it only prints that invoice?

thanks, dennis
 
To set a filter in a report, you have to load() it first. Set the filter. Then run the report.

Have NOT tested the below, but it should be fairly accurate:

Code:
 var
 r Report
 dynFilter DynArray[] String
 endVar

r.load("reportname", WinStyleDefault + WinStyleHidden)
dynFilter["fieldname"] = "valuetofilterby"
r.field_or_MRO_or_tableframe.setGenFilter(dynFilter)
r.run()
r.show()


Tony McGuire
"It's not about having enough time. It's about priorities.
 
An alternate way to print a single invoice would be

Query the data you wish to print to a temp table.

Print the invoice report, which would be based on the temp table.

The temp table could also just be a single (keyed) field table that the report has in the data model, linked to the main table of info.


Tony McGuire
"It's not about having enough time. It's about priorities.
 
I use the following code to print a single report, based roughly on Tony's answer. If I remember correctly there is a section about this particular need on Lance Leonard's site at
method pushButton(var eventInfo Event)
var
rHandle Report ;// tmp handle to report
rpiHandle ReportPrintInfo ;// tmp handle to print info structure
tblName String
tblVar Table
rpi ReportPrintInfo ; parameters for the report
rpt Report ; the report itself
tc tCursor ; used to capture the current record
;obj UIObject
endVar
tblName="Cust2.db"
;obj.attach(Cust1)
tblVar.attach(tblName)
tblVar.empty()
dodefault
edit()
unlockrecord()
; ExamDate = Today()

Postrecord()
endedit()

tc.attach(customer_No)
tc.setrange(Customer_No.Value, Customer_No.Value)
tc.instantiateView( ":pRIV:ANSWER" )

rpi.Name = "G1.rsl"
rpi.MasterTable = ":pRIV:ANSWER"

rpt.print ( rpi )


;movetorecno(1)


;// Properties of the ReportPrintInfo can be viewed using the following
;// line of code:
;//
;rpiHandle.view()

;// Set name of report.
;//
; rpiHandle.name = "New Record Card.rsl"

;// Print the report
;//
; if NOT rHandle.print(rpiHandle) then
; msgStop("Error printing " + rpiHandle.name,
; "Please make sure the report exists and try again.")
; endIf

endMethod
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top