WITH THIS
.busCustomer = CreateObject("Business.busCustomer")
.busCustomer.InitializeData() && get the bus obj to set up its data
ENDWITH
<\PRE>
Assume there are some textboxes and one is txtPhone, in txtPhone's Valid you might;
IF THIS.Parent.busCustomer.FindCustomer("Phone",ALLTRIM(THIS.Value))
WITH THIS
.lstCustomers.Clear
.lstCustomers.AddItem(.busCustomer.GetFieldValue("Name") ;
,.lstCustomers.NewItemId+1,1)
.lstCustomers.AddItem(STR(.busCustomer.GetFieldValue("CustId")) ;
,.lstCustomers.NewItemId,2)
DO WHILE .busCustomer.GetNextCustomer()
.lstCustomers.AddItem(.busCustomer.GetFieldValue("Name") ;
,.lstCustomers.NewItemId+1,1)
.lstCustomers.AddItem(STR(.busCustomer.GetFieldValue("CustId")) ;
,.lstCustomers.NewItemId,2)
ENDDO
ENDIF
<\PRE>
Of course this code is demo only, but it does show that the actual business object has no UI at all. It retrieves and writes data only. It contains all the intelligence to know how to deal with the entity it represents. It can be used by VF or VB or Excel or anyother host for an ActiveX server and it will do the same thing. It is UI and data independent.
The business object provides for the UI to be data source independent by presetning a consistent interface to the data. In the example I only need to change code in the busCustomer class to change the data source form VFP to Oracle, the UI knows nothing about where the data comes from.
As an N-Tier design, if I change the code in the busCustomer class all applications that use that class now get their data from somewhere else. There is no need to change code in any application using the class.