Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing variables to report form
Message
De
26/07/2002 03:49:38
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
25/07/2002 19:34:15
Gavin Reid
L & M Marketing Pty Ltd
Frenchs Forest, Australie
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
00682832
Message ID:
00682885
Vues:
13
>Hi All,
>
> I'm currently working on customising a 3rd party VFP6.0 application. The customisation involves among other things creating reports from complex selection screens. I'm using SQL in most cases to create a cursor which I use as the driving table for the reports. A number of the reports need to print the selection parameters from the selection screens at the top of each report. E.g. if I selected customers 1 to 100, transactions posted 1st July to 31st July and revenue in the range $1,000.00 to $2,000.00 I want to print these parameters at the top of the report. I decided to create another cursor which has 1 record and contains the selection parameters and in the report I would place these cursor fields at the top of the report. Does anyone see anything wrong or inefficient with this approach? Would using variables that are set just before the report is printed (e.g cCustomerFrom = ThisForm.txtCustomerFrom.Value ) and referring to these variables in the report be a better approach?
>
>All suggestions welcomed.
>
>Thanks,
>Gavin...

Gavin,
You could use another cursor - not technically wrong. However not needed IMHO. Report form's advantage is that for the calling routine it's a command not another routine. That's anything that could be accessed from the caller routine could be accessed by the report itself too - including local variables. ie:
* Some method of form
local myStartDate, myEndDate
local oCargo
* This method could access ThisForm.txtCustomerFrom.Value
* thus report itself could directly access and use it too
myStartDate = date(year(date()),1,1)
myEndDate = date()
oCargo1 = NewObject('relation')
oCargo1.Addproperty('myProperty1','myValue')
oCargo1.Addproperty('minAmt',100)
oCargo1.Addproperty('maxAmt',1000)
oCargo1.Addproperty('selectedCustId',thisform.selcustlist.value)
oCargo1.Addproperty('arrayProducts[1]','')
select ProductName ;
 from mytable ;
 where mySelectionCriteriaForReport ;
 into array oCargo1.arrayProducts

* And yet another cargo object
create cursor rptCargo ;
 (StartCust i, EndCust i, dFrom d, dTo d, RevMin y, RevMax y)
insert into rptCargo values ;
 (1,100,{^2002/07/01},{^2002/07/31},1000,2000)
scatter name oRptCargo
use in 'rptCargo'

* create the cursor for report
select ....
report form ...

* From within Report now u can use all of the above in field expr. - like :
Customers from < ThisForm.txtCustomerFrom.Value > to < oRptCargo.EndCust >
Report date from < m.myStartDate >
Report filtered values from < oCargo1.minAmt >
*etc.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform