EDMIService: Property Filtering/Sorting, Handle Empty Results
This commit is contained in:
@@ -82,9 +82,18 @@ Public Class EDMIService
|
||||
' Apply filter and sorting to data
|
||||
Dim oFilterExpression As String = Utils.NotNull(FilterExpression, String.Empty)
|
||||
Dim oSortByColumn As String = Utils.NotNull(SortByColumn, String.Empty)
|
||||
Dim oFilteredTable = oDataTable.
|
||||
Select(oFilterExpression, oSortByColumn).
|
||||
CopyToDataTable()
|
||||
|
||||
Dim oFilteredRows = oDataTable.Select(oFilterExpression, oSortByColumn)
|
||||
Dim oFilteredTable As DataTable = Nothing
|
||||
|
||||
If oFilteredRows.Count > 0 Then
|
||||
oFilteredTable = oFilteredRows.CopyToDataTable()
|
||||
oFilteredTable.TableName = Name
|
||||
Else
|
||||
' Produce empty table
|
||||
oFilteredTable = oDataTable.Clone()
|
||||
oFilteredTable.TableName = Name
|
||||
End If
|
||||
|
||||
_logger.Debug("Datatable Stats for [{0}]:", Name)
|
||||
_logger.Debug("Unfiltered: [{0}] rows", oDataTable.Rows.Count)
|
||||
@@ -94,14 +103,6 @@ Public Class EDMIService
|
||||
Else
|
||||
Throw New ApplicationException($"DataTable {Name} does not exist")
|
||||
End If
|
||||
|
||||
'If oDataset.Tables.Contains(Name) Then
|
||||
' oDataTable = oDataset.Tables.Item(Name).Clone()
|
||||
|
||||
' Return New TableResult(oDataTable)
|
||||
'Else
|
||||
' Throw New ApplicationException($"DataTable {Name} does not exist")
|
||||
'End If
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return New TableResult(ex.Message)
|
||||
|
||||
Reference in New Issue
Block a user