I made a report with VPE Wizard for printing all order lines of a customer. Customer no is selected and I base the report on an index made up of Customer_no; item_no; Recnum. The body prints OK.
In the header I want some information about the customer. If I print fields from the customer file, I get information from the customer of the order line after the last one in the report.
However, If I print orderline.customerno in the header, I get the right customer no. I tried with RELATE ORDERLINE before printing. It didn't help. I tried with CLEAR CUSTOMER, MOVE chosen customer TO CUSTOMER.CUSTOMER_NO, FIND EQ CUSTOMER BY INDEX.1. Then I got the right header information. But should that really be necessary?
/Bengt
This is my autogenerated and simplified report
use windows.pkg
use DFRptVw.pkg
use DFRpt.pkg
use flexml.pkg // needed for xml export
Use szVpeAll.pkg
Use cszVpeReportView.pkg
Use cszVpeReport.pkg
Use ART.DD
Use SSO.DD
Use KUN.DD
Use ORL.DD
Use ORH.DD
Use VAXT.DD
ACTIVATE_VIEW Activate_oTestVPE_RV FOR oTestVPE_RV
Object oTestVPE_RV is a cszVpeReportView
Set Label to "TestVPE"
Set Location to 6 6
Object SSO_DD is a Sso_DataDictionary
End_Object // SSO_DD
Object KUN_DD is a Kun_DataDictionary
End_Object // KUN_DD
Object ORH_DD is a Orh_DataDictionary
Set DDO_Server To (KUN_DD(self))
End_Object // ORH_DD
Object VAXT_DD is a Vaxt_DataDictionary
End_Object // VAXT_DD
Object ART_DD is a Art_DataDictionary
Set DDO_Server to (VAXT_DD(Self))
Set DDO_Server to (SSO_DD(Self))
End_Object // ART_DD
Object ORL_DD is a Orl_DataDictionary
Set DDO_Server to (ORH_DD(Self))
Set DDO_Server to (ART_DD(Self))
// USE constraints for selection
Procedure OnConstrain
Local String sCustomer
Get Value of (oSelStart1(oSelectGroup1(Self))) to sCustomer
Constrain ORL.KUNDNR EQ sCustomer
End_Procedure
End_Object // ORL_DD
Set Main_DD to (ORL_DD(self))
Set Server to (ORL_DD(self))
Object oSelectGroup1 is a Group
Set Label to "Select KUNDNR"
Set Size to 34 165
Set Location to 5 6
Object oSelStart1 is a Form
Set Size to 13 50
Set Location to 13 30
Set Form_datatype to ASCII_WINDOW
Set Label_Justification_Mode to jMode_Right
Set Label_Col_Offset to 2
Set Label to "Customer:"
Set Status_Help to "First value in selection range."
End_Object
End_Object
Object oBtnPrint is a Button
Set Label to "Print"
Set Size to 14 50
Set Location to 43 179
Set Status_Help to "Print the Selected report"
Set Default_State to True
Procedure OnClick
Send RunReport
End_Procedure
End_Object // oBtnPrint
Object oBtnCancel is a Button
Set Label to "Cancel"
Set Size to 14 50
Set Location to 61 179
Set Status_Help to "Close this Panel"
Procedure OnClick
Send Close_Panel
End_Procedure
End_Object
Object oTestVPE is a cszVpeColumnReport
Set Size to 20 20
Set Location to 83 195
Set Main_File TO ORL.file_number
Set pbRegisterDocumentWithParent TO FALSE
Set Visible_State TO FALSE
Set pbPrintFooterAtBottom TO TRUE
Set pbSubheadersOnAllPages TO TRUE
Set Server TO (ORL_DD(Self))
Set ordering to 1 //Fields: Customer_no ; Item_No ; Recnum
// Use sentinel
Set pbUseSentinel TO TRUE
// use manual selection
Function Selection Returns Integer
Send DoUpdateStatusPanel ("Processing record#: "+String(ORL.recnum))
Function_Return RPT_OK
End_Function
SZDEFINE_COLUMNS
SZADD_COLUMN 6 "Order Nr" (szFormatToDecimalsEx(Orl.Order_nr,6,FALSE)) VPE_ALIGN_RIGHT
SZADD_COLUMN 4 "Rad" (szFormatToDecimalsEx(Orl.Rad,4,FALSE)) VPE_ALIGN_RIGHT
SZADD_COLUMN 12 "Artkod" (trim(Orl.Artkod))
SZADD_COLUMN 6 "Ant Best" (szFormatToDecimalsEx(Orl.Ant_best,6,FALSE)) VPE_ALIGN_RIGHT
SZADD_COLUMN 6 "Ant Lev" (szFormatToDecimalsEx(Orl.Ant_lev,6,FALSE)) VPE_ALIGN_RIGHT
SZADD_COLUMN 16 "Latin" (trim(Orl.Latin))
SZENDDEFINE_COLUMNS
Procedure OnInitializeDoc
Forward Send OnInitializeDoc
Send DoVpeSetPageFormat VPAPER_LETTER
End_Procedure
SZDEFINE_SECTION SZPAGEHEADER "PageHeader" 150 FORCE_PAGEBREAK_NONE FALSE
Procedure DoOutputSection
//Local String sCustomer //with this I get information from the right customer
//Get Value of (oSelStart1(oSelectGroup1(Self))) to sCustomer
//Clear KUN
//Move sCustomer to KUN.KUND_NR
//Find EQ KUN by Index.1
Send szWriteln ""
Send DoVpeSetFontSize 16
Send szWrite " - TestVPE "
Send szWrite KUN.KUND_NR
//Customer_no of order line after them of the choosen customer is printed
Send DoVpeSetFontSize 10
End_Procedure
SZEND_SECTION
SZDEFINE_SECTION SZPAGETITLE "PageTitle" 50 FORCE_PAGEBREAK_NONE FALSE
Set pbOverrideFormatting TO TRUE
Procedure DoOutputSection
Send DoOutputColumnHeader
End_Procedure
SZEND_SECTION
SZDEFINE_SECTION SZBODY "Body" 100 FORCE_PAGEBREAK_NONE FALSE
Set pbOverrideFormatting TO TRUE
Procedure DoOutputSection
Send DoOutputColumnSection
End_Procedure
SZEND_SECTION
End_Object // oTestVPE
Procedure RunReport
Send PreviewReport to oTestVPE VPE_PREVIEW_AT_END
End_Procedure
Set Size to 133 240
End_Object // oTestVPE_RV