Return data from every object in a dbView: Difference between revisions

From DataFlex Wiki
Jump to navigationJump to search
m
Added to Tutorials category
m (Added to Tutorials category)
 
(4 intermediate revisions by 2 users not shown)
Line 2: Line 2:


====Use an array to hold the object ID====
====Use an array to hold the object ID====
You can use an array to hold the ObjectID of each object.  Then  
You can use an array to hold the ObjectID of each object.  Then loop thru the array and ask the property of each object.
loop thru the array and ask the property of each object.


<source lang="dataflex">
  // outside the dbview:
  // outside the dbview:
  Object oMyViewObjects is an Array
  Object oMyViewObjects is an Array
Line 20: Line 20:
     Set Value of hoArray Item (Item_Count(hoArray)) to (Object_ID(Self))
     Set Value of hoArray Item (Item_Count(hoArray)) to (Object_ID(Self))
  End_Procedure
  End_Procedure
</source>


====Using Broadcast send====
====Using Broadcast send====
Line 31: Line 32:
In global scope:
In global scope:


<source lang="dataflex">
  Procedure CallbackReportExistance For cObject Integer iMsg Handle hoId
  Procedure CallbackReportExistance For cObject Integer iMsg Handle hoId
     Send iMsg to hoID Self
     Send iMsg to hoID Self
  End_Procedure // CallbackReportExistance
  End_Procedure // CallbackReportExistance
</source>


In local scope:
In local scope:


<source lang="dataflex">
  Procedure AddObject Handle hoObject
  Procedure AddObject Handle hoObject
     Move hoObject to ghoObject[SizeOfArray(ghoObject)]
     Move hoObject to ghoObject[SizeOfArray(ghoObject)]
Line 42: Line 46:
   
   
  Broadcast Send CallbackReportExistance of hoView msg_AddObject Self
  Broadcast Send CallbackReportExistance of hoView msg_AddObject Self
</source>


====Using Broadcast get====
====Using Broadcast get====
Line 50: Line 55:
Something like this:
Something like this:


<source lang="dataflex">
  Procedure AddProperty ByRef Handle[] hoaObject ByRef Integer[] iaProperty
  Procedure AddProperty ByRef Handle[] hoaObject ByRef Integer[] iaProperty
     Move Self to hoaObject[SizeOfArray(hoaObject)]
     Move Self to hoaObject[SizeOfArray(hoaObject)]
Line 56: Line 62:


  Broadcast Send MyProcedure
  Broadcast Send MyProcedure
</source>


====External links====
====External links====
This how-to was taken straight from this thread:
[http://www.sture.dk/wasp/threadreport.asp?ThreadId=40753 This how-to was taken straight from thread 40753]
http://www.sture.dk/wasp/threadreport.asp?ThreadId=40753


http://www.dataaccess.com/kbasepublic/KBPrint.asp?ArticleID=2363
Another approach:
[http://www.dataaccess.com/kbasepublic/KBPrint.asp?ArticleID=2363 HOWTO: Enumerate all child objects of a (db)View]
 
[[Category:How To]]
[[Category:Tutorials]]

Navigation menu