Step 3. Create a Hidden Filter for iii_Accounts
VFW124 – Using Business Object SubTypes
You are developing a demonstration application which runs without real data or files. The hidden filter will populate the instance list with a fixed set of accounts values.
1. Create a
iiiVFW39
Accounts Hidden Filter
2. Replace the components code with the following:
Begin_Com Role(*EXTENDS #VF_AC007) Height(148) Hint(*MTXTDF_FILT5) Width(291)
* =============================================================================
* Method Definitions
* =============================================================================
* Handle initialization of this filter by redefining the default behaviour
Mthroutine Name(uInitialize) Options(*Redefine)
* Invoke the uInitialize behaviour in the ancestor
Invoke Method(#Com_Ancestor.uInitialize)
* Make this a hidden filter
Set Com(#Com_Owner) Avhiddenfilter(TRUE)
* Make up a set of dummy bank accounts ....
* Indicate start of list update and set the framework to busy
Invoke Method(#avListManager.BeginListUpdate)
* Clear the list first
Invoke Method(#avListManager.ClearList)
* Make up some dummy accounts
Execute Subroutine(Add) With_Parms('67383940' 'Fred Bloggs' 465.12 SAVINGS)
Execute Subroutine(Add) With_Parms('73839915' 'Fred Bloggs' 34567.78 INVESTMENT)
Execute Subroutine(Add) With_Parms('74849192' 'Fred Bloggs' 12354.56 CHECK)
Execute Subroutine(Add) With_Parms('74848949' 'Mary Smith' 1465.12 SAVINGS)
Execute Subroutine(Add) With_Parms('51617283' 'Mary Smith' 354.56 CHECK)
Execute Subroutine(Add) With_Parms('71828234' 'Mary Smith' 347.78 INVESTMENT)
Execute Subroutine(Add) With_Parms('91828373' 'Mary Jones' 5162.45 SAVINGS)
Execute Subroutine(Add) With_Parms('71726364' 'Mary Jones' 167.89 CHECK)
Execute Subroutine(Add) With_Parms('84849596' 'Mary Jones' 65363.67 INVESTMENT)
* Indicate end of list update
Invoke Method(#avListManager.EndListUpdate)
Endroutine
* =============================================================================
* Subroutines
* =============================================================================
* Add accounts to the list with appropriate subtypes
Subroutine Name(ADD) Parms((#T_ACC *Received) (#T_NAM *Received) (#T_BAL *Received) (#T_TYP *Received))
Define Field(#T_ACC) Type(*char) Length(10) Desc('Account Number')
Define Field(#T_NAM) Type(*char) Length(50) Desc('Account Description')
Define Field(#T_BAL) Type(*Dec) Length(11) Decimals(2) Desc('Account Balance')
Define Field(#T_TYP) Type(*char) Length(20) Desc('Account Type')
Case Of_Field(#T_TYP)
When Value_Is('= SAVINGS')
Invoke Method(#avListManager.AddtoList) Akey1(#T_ACC) Visualid1(#T_ACC) Visualid2(#T_NAM) Acolumn1(#T_TYP) Ncolumn1(#T_BAL) Subtype(SAV)
When Value_Is('= CHECK')
Invoke Method(#avListManager.AddtoList) Akey1(#T_ACC) Visualid1(#T_ACC) Visualid2(#T_NAM) Acolumn1(#T_TYP) Ncolumn1(#T_BAL) Subtype(CHK)
When Value_Is('= INVESTMENT')
Invoke Method(#avListManager.AddtoList) Akey1(#T_ACC) Visualid1(#T_ACC) Visualid2(#T_NAM) Acolumn1(#T_TYP) Ncolumn1(#T_BAL) Subtype(INV)
Endcase
Endroutine
End_Com
3. Compile the reusable part and review the logic.
a. The subroutine
is passed parameters of account number, account name, account balance and subtype and adds an instance list entry with appropriate values.b. Note that AColumn1 contains the visible account type value and Subtype contains the subtype code.
c. The
method execute the subroutine nine times to set up the instance list.4. Open the
dialog for the Accounts business object. Select the tab and plug in the hidden filter, iiiVFW39. Use the dialog, which will plug in using Identifier.5.
your framework. Select Accounts and your filter should now be populated: