wwUtils::CollectionToCursor

Updates a cursor from a collection by doing GATHER NAME MEMO for each member. An optional search expression can be provided for each item to allow updating existing records.

It's important to note that the result cursor or table has to exist and be open in order to accurately determine the data schema to import to.

*** Create a collection from Data
select * from Customers INTO CURSOR TQuery
loData = CursorToCollection("TQuery")
close data

*** IMPORTANT: Writable table/cursor has to exist
SELECT * FROM Customers where .F. ;
         INTO CURSOR TImported READWRITE

*** Load data into a cursor from a collection
CollectionToCursor(loDataCollection,"TImported")
CollectionToCursor(loCollection, 
    lcAlias, 
    lcSearchExpression)

Return Value

.T. or .F.

Parameters

loCollection
The collection of SCATTER NAME style objects to save.

lcAlias
Alias of the table to import to. If not passed ALIAS() is used.

lcSearchExpression
An optional expression that allows comparing records to find matches to update. Example: "pk = item.pk"

The expression is evaluated using macro substitution. The collection item is available as 'item' (ie. item.pk, item.descript etc.)

Remarks

The cursor that is to receive the data has to exist. If necessary create a cursor using CREATE CURSOR or by selecting an empty SELECT READWRITE query set.


See also:

Class wwUtils | wwUtils::CursorToCollection

© West Wind Technologies, 2023 • Updated: 05/31/21
Comment or report problem with topic