wwBusinessChildCollection::LoadFromCursor

Loads the oRows collection with the contents of the active cursor. The active cursor should reflect the business object you are loading into.

o.LoadFromCursor(lcBusObjectClass, lcCursor)

Return Value

.T. or .F.

Parameters

lcBusObjectClass
Optional - If the class is set, the collection is filled with business objects with their .oData member set to the cursor data. Use this if you want true child business objects

If empty the cursor data is directly loaded into the .oRows collection using SCATTER NAME MEMO. Use this if you just want child data in a collection.

lcCursor Optional - name of the cursor to load. Cursor is loaded from alias and then reset.

Remarks

You can use either approach to create one to many child objects. Using no class can be more efficient but might require additional code to handle save and other update operations. The recommended procedure in that case is to create a full business object and set its oData member to the data from the data array.

When using actual objects you take the performance on all objects whether you need them or not while in the SCATTER NAME mode you only load an actual child object when its accessed.

Example

*** Using only SCATTER NAME
use wws_LineItems
oItems = CREATEOBJECT("wwItemList")
oItems.LoadFromCursor()
? oItems.oRows[1].Sku
? oItems.oRows[1].Description

*** Using a wwBusiness class
oItems = CREATEOBJECT("wwItemList")
oItems.Loadfromcursor("cLineItems")
? oItems.oRows[1].oData.Sku
? oItems.oRows[1].oData.Description
oItems.oRows[1].oData.Discount = .20
? oItems.oRows[1].CalculateItemTotal()

See also:

Class wwBusinessChildCollection |

© West Wind Technologies, 1996-2019 • Updated: 03/05/19
Comment or report problem with topic