Data Access Worldwide Knowledge Base

Article ID 2314
Article Title EXAMPLE: Object Oriented version of For_All
Article URL http://www.dataaccess.com/kbasepublic/KBPrint.asp?ArticleID=2314
KBase Category VDF12
Date Created 05/23/2007
Last Edit Date 05/23/2007


Article Text
The For_All command is a macro/command not really belonging in the object oriented way of programming. Internally the command uses subroutines. The enclosed example workspace contains a new class, cForAll, which enables you to do for all constructions in an object oriented fashion.

You can create static and dynamic (Create function) objects of the class. For example:

Object oForAllOrders Is A cForAll
    Set piMainTable To Orderhea.File_number
    Set piOrdering To Index.1
End_Object // oForAllOrders

On all events (e.g. OnPreFindRecords, OnRecordFound, OnPostFindRecords) you can assign your own event handler.

You can connect two cForAll objects (for parent relationships) by sending the message DoAddParentForAll passing the parent cForAll object ID.

Object oForAllCustomers Is A cForAll
    Set piMainTable To Customer.File_Number

    Procedure OnRecordFound Handle hoForAll RowId riRecord
        Send AppendTextLn Of oResultsBox Customer.Name
        Send DoStartProcess Of oForAllOrders
    End_Procedure // OnFoundRecord
End_Object // oForAllCustomers

Object oForAllOrders Is A cForAll
    Set piMainTable To Orderhea.File_Number
    Send DoAddParentForAll oForAllCustomers

    Procedure OnRecordFound Handle hoForAll RowId riRecord
    End_Procedure // OnFoundRecord
End_Object // oForAllOrders


Contributed By:
Vincent Oorsprong
Company: Data Access Worldwide
email: vincent.oorsprong@dataaccess.eu
Web Site: http://www.dataaccess.eu

Web Links Related to this Article
File cForAll.zip
URL=http://www.dataaccess.com/KBasePublic/Files/2314.cForAll.zip


Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2010 Data Access Corporation. All rights reserved.

The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.