Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Collection Object with report
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Title:
Using Collection Object with report
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01017295
Message ID:
01017295
Views:
75
I have a ReportBizObj that is instantiated in the MyReport Click Event on MyForm.
In this ReportBizObj after setting up a FieldValueCollectionObject property and some other properties I call ReportBizObj.Get()

There I have the following code
WITH this
	loFieldValueCol = .FieldValueCol &&Collection
        *Below a collection of alias names for open cursor adapter cursors. 
        *These are all connected to the form that holds the print report button
        *The parent form allows you to edit repair order information. 
	loAliasCol = .Aliascol
	lcLookupAlias = .Lookupca.alias  &&Cursor Adapter created alias for lookup table
ENDWITH


lcAlias= loAliasCol.item('RepairOrder') &&retrieves cursoradapter alias for Repair_ord table
SELECT(lcAlias) 
loFieldValueCol.Add(&lcAlias .order_num, 'RepairOrderNumber')
loFieldValueCol.Add(&lcAlias	.hat_numb, 'HatNumber')
loFieldValueCol.Add(&lcAlias .model, 'Model')
loFieldValueCol.Add(&lcAlias .model_trim, 'Trim')
loFieldValueCol.Add(&lcAlias .veh_year, 'Year')
loFieldValueCol.Add(&lcAlias .opened, 'Opened')
loFieldValueCol.Add(&lcAlias .projected, 'Projected')
lnCustomerKey = &lcAlias .cust_key
lnInsKey = &lcAlias .ins_key
lnSWKey = &lcAlias .sw_key
lnMakeKey = &lcAlias .make_key
lnColorKey = &lcAlias .color_Key

LOCATE &&go to top of record
lcAlias = loAliasCol.Item('CustInfo')
SELECT(lcAlias)
lcName = &lcAlias .first_n + ' ' + &lcAlias .last_n
loFieldValueCol.Add(lcName, 'CustomerName')

lcAlias = lcLookupAlias
SELECT(lcAlias)
LOCATE FOR lup_id = lnSWKey
IIF(FOUND(), loFieldValueCol.Add(&lcAlias .lup_value, 'CSR'), loFieldValueCol.Add('', 'CSR'))
LOCATE FOR lup_id = lnInsKey
IIF(FOUND(), loFieldValueCol.Add(&lcAlias .lup_value, 'InsuranceCompany'), loFieldValueCol.Add('', 'InsuranceCompany'))
LOCATE FOR lup_id = lnMakeKey
IIF(FOUND(), loFieldValueCol.Add(&lcAlias .lup_value, 'Make'), loFieldValueCol.Add('', 'Make'))
LOCATE FOR lup_id = lnColorKey
IIF(FOUND(), loFieldValueCol.Add(&lcAlias .lup_value, 'Color'), loFieldValueCol.Add('', 'Color'))

RETURN 
After this I call:
REPORT FORM WindShieldSticker.frx PREVIEW

In the report I tested with just one field retrieving a value from the Collection of Field Values:

this.FieldValueCol.item('RepairOrderNumber')


(sorry for the lengthy setup)

Questions
Why would it try to print this value 13 times? I did notice that the lookuptable where I use the locate commands contains 13 values in it. Am I putting a loop in it inadvertantly? I can't find it.

Also, is this an entirely retarded way of doing things?

Thanks
Next
Reply
Map
View

Click here to load this message in the networking platform