Description |
DataViewToDNDataTable (Magic xpa 3.x)
Generates a .NET DataTable object from the current data view.
|
Syntax:
|
DataViewToDNDataTable (generation, task var names, display var names)
|
Parameters:
|
generation: Numeric. A number that represents the task's hierarchic position in the runtime task tree. 0 represents the current task, 1 its immediate ancestor, and so on.
task var names: Alpha. A comma-delimited list of all the names of the variables that will be exported.
display var names: String. A comma-delimited list of all the field names of the variables that will be displayed. If this string is empty, there will be no field headers. If the list is evaluated to ‘@’, then the engine will export the headers as defined in the task. If the name has a comma, it will be prefixed by the backslash (\) character.
|
Returns:
|
A .NET DataTable object from the current data view
|
Usage:
|
You can use this function in any of the following ways:
-
In an Online or a Rich Client interactive task that browses the data – if you want to export the current data view.
-
In a Batch or a Rich Client non-interactive task – if you want to export data without browsing it.
In this case, since the function itself generates and scans the data view, the task that holds the data view definition can end without scanning the records. This task can be defined as follows:
-
Define the Main Data Source with the data source and ranges on columns according to the data you want to export.
-
Call the function in the Task Suffix logic unit.
-
Set the End task condition to Yes and the Evaluate condition to Before entering record. This way the task will not scan all of the records.
|
Note:
|
-
This is a client-side function. Although the function requires access to the server to get all the data view records, when used in Rich Client, the .NET object will be created in the client, so it will be available for .NET controls.
-
The function can be used in non-interactive tasks, so it will be possible to call a non-interactive subtask which ends immediately, and get a .NET DataTable with all the records of the data view, so it will be used in a DataGrid control of a parent task.
-
If you want to only populate the table with certain values, then you can use a range on the table.
-
In any case of an error derived from .NET, the function will return Null and raise a .NET exception: DNExceptionOccurred() will return True and DNException() will refer to the exception object.
-
If the Variable Names list is evaluated to ‘@’, then the engine will export the headers as defined in the task according to the Variable list.
-
If a name in the Task Vars List is OLE, BLOB, .NET or Vector, the function will fail.
|
Platform specific:
|
This function is not supported for mobile devices.
|
Exceptions:
|
This function is not supported for Web Service databases.
|
See also:
|
The Online and Rich Client Samples projects (program RP02, RP02b and RRP02, RRP02b)
|
|
|
---|