CustomObject: Variant;
CustomObject: object;
Property is to be read-only.
The CustomObject property returns the object, that is the data source, obtained with help of custom 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
UsProv: IDtUserProviderEx;
CustProv: IDtCustomProvider;
Values: Array;
ReadingRows: Integer;
b: Object;
Begin
UsProv := New DtUserProviderEx.Create;
UsProv.Metabase := MetabaseClass.Active;
UsProv.ImplClass := "CUSTOM_LOAD.MyDtCustomProvider";
UsProv.Open;
UsProv.FieldsFromFile;
b := UsProv.CustomObject As Object;
CustProv := b 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;
Result of the example execution: there will be an attempt to load strings from data consumer, that was obtained using a custom algorithm, in the Values array using custom algorithm. In the console window the number of actual loaded strings will be shown.
Executing the example requires a .NET assembly with the CUSTOM_LOAD_NET identifier, containing the MyDtCustomProvider class.
Imports Prognoz.Platform.Interop.Dt;
…
Public Shared Sub Main(Params: StartParams);
Var
UsProv: IDtUserProviderEx;
CustProv: IDtCustomProvider;
Values: Array;
ReadingRows: Integer;
b: Object;
Begin
UsProv := New DtUserProviderEx.Create();
UsProv.Metabase := Params.Metabase;
UsProv.ImplClass := "CUSTOM_LOAD_NET.MyDtCustomProvider";
UsProv.Open();
UsProv.FieldsFromFile();
b := UsProv.CustomObject As Object;
CustProv := UsProv.CustomObject As IDtCustomProvider;
If CustProv.ImplementFetchRows() Then
CustProv.FetchRows(10, Var Values);
Else
While Not CustProv.Eof Do
CustProv.Fetch(Var Values);
End While;
End If;
ReadingRows := CustProv.ReadingRowsCount();
System.Diagnostics.Debug.WriteLine("Read " + ReadingRows.ToString() + " rows");
UsProv.Close();
End Sub;
Result: there will be an attempt to load first ten strings from data consumer, that was obtained using the custom algorithm, with the help of the custom algorithm. In the console window the number of actual loaded strings will be shown.
See also: