CustomObject: Variant;
Property is to be read-only.
The CustomObject property returns the object that is the data provider obtained with help of user algorithm.
Data provider is available after the IDtObject.Open method activation only.
Executing the example requires a module with the CUSTOM_LOAD identifier containing the MyDtCustomProvider class. Add links to the Metabase, Dt system assemblies.
Sub UserProc_CustomObject;
Var
MB: IMetabase;
UsProv: IDtUserProviderEx;
CustProv: IDtCustomProvider;
Values: Array;
ReadingRows: Integer;
Begin
MB := MetabaseClass.Active;
UsProv := New DtUserProviderEx.Create;
UsProv.Metabase := MB;
UsProv.Module := MB.ItemById("CUSTOM_LOAD");
UsProv.Macro := "MyDtCustomProvider";
UsProv.Open;
UsProv.FieldsFromFile;
CustProv := UsProv.CustomObject As IDtCustomProvider;
If CustProv.ImplementFetchRows Then
CustProv.FetchRows(10, Values);
Else
While Not CustProv.Eof Do
CustProv.Fetch(Values);
End While;
End If;
ReadingRows := CustProv.ReadingRowsCount;
Debug.WriteLine("Read " + ReadingRows.ToString + " rows");
UsProv.Close;
End Sub UserProc_CustomObject;
Example execution result: there will be an attempt to load rows from data consumer obtained using a user algorithm in the Values array using user algorithm. The console window displays the number of actual loaded rows.
See also: