chokka
asked on
How to filter Dataset in Vb.Net
My actual dataset - tempDS populates more than one datatable.
I need to filter the dataset for the DataTable : tree_categories
Sample query
select * from tree_categories where GROUP_CODE <> PA.43.948'
DataTable : tree_Categories
Column Name : GROUP_CODE
Dim tempDs As DataSet = ds
Dim dtTable As DataTable = tempDs.Tables("p_tree_cate gories")
How to filter a Dataset in Vb.Net ?
I need to filter the dataset for the DataTable : tree_categories
Sample query
select * from tree_categories where GROUP_CODE <> PA.43.948'
DataTable : tree_Categories
Column Name : GROUP_CODE
Dim tempDs As DataSet = ds
Dim dtTable As DataTable = tempDs.Tables("p_tree_cate
How to filter a Dataset in Vb.Net ?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
actual method
Public Function LoadBaseTree(ByVal ds As DataSet) As Boolean
Dim result As Boolean = False
Dim tempDs As DataSet = ds
If BaseTreeLoaded = False Then
If ShowProductNotInElement = True Then
'implement function to append product not in element
tempDs = mergeTables(ds)
End If
result = MyBase.ApplySelectionCriteriaData(tempDs, Me.Name, GroupTableName, ItemTableName, GroupItemTableName, MyBase.ValidatorItemTableName, MyBase.ValidatorItemDataTableName, True, True, True, True)
If result = True Then
_baseTreeLoaded = True
End If
Else
ClearSelections()
result = True
End If
Return result
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
'Your Codes
'.
'.
'.
Dim result() As DataRow = dtTable.Select("GROUP_CODE <> 'PA.43.948'")
Dim FunctionResualt As Boolean = False
If result IsNot Nothing Then
FunctionResualt = True
Else
FunctionResualt = False
End If
Return FunctionResualt
End Function
ASKER
When i write the merge syntax
tempDs.Merge(ds.Tables("p_ tree_categ ories").Se lect( "GROUP_CODE <> 'PA.43.948'"))
My original ds has 23 tables.
On writing merge, i am able to get only p_tree_categories table. I am not able to include remaining 22 tables.
In my req, i need to get all the tables in the Dataset. Along with filtered - p_tree_categories
tempDs.Merge(ds.Tables("p_
My original ds has 23 tables.
On writing merge, i am able to get only p_tree_categories table. I am not able to include remaining 22 tables.
In my req, i need to get all the tables in the Dataset. Along with filtered - p_tree_categories
ASKER
tempDs.Merge(ds.Tables("p_ tree_categ ories").Se lect( "GROUP_CODE <> 'PA.43.948'"))
tempDs.Merge(ds,True)
After writing the syntax,i am able to get the remaining 22 tables. Values populating the duplicate value of records.
tempDs.Merge(ds,True)
After writing the syntax,i am able to get the remaining 22 tables. Values populating the duplicate value of records.
ASKER
I am merging all my ds.Tables to my test Dataset.
Issue is : testDs.Merge(ds.Tables("p_ tree_data" )) - p_tree_data doesnt have row of records. When there is no row of records, table has to be merged with Dataset. Right now, when there is no row of records, table is not get merged. How to fix this issue
Issue is : testDs.Merge(ds.Tables("p_
Dim testDs As DataSet = New DataSet()
testDs.Merge(ds.Tables("p_pay_cmp_cursor"))
testDs.Merge(ds.Tables("p_pay_cmp_pln_cursor"))
testDs.Merge(ds.Tables("p_currency_cursor"))
testDs.Merge(ds.Tables("p_tree_categories").Select("SCR_DPY_SEQ <> '20116000'"))
testDs.Merge(ds.Tables("p_tree_data"))
testDs.Merge(ds.Tables("p_prod_override_cursor"))
testDs.Merge(ds.Tables("p_tree_val_item"))
testDs.Merge(ds.Tables("p_tree_val_item_data"))
testDs.Merge(ds.Tables("p_bonus_cat_cursor"))
testDs.Merge(ds.Tables("p_bonus_item_cursor"))
testDs.Merge(ds.Tables("p_managed_results"))
testDs.Merge(ds.Tables("p_tree_group_categories"))
testDs.Merge(ds.Tables("p_component_type_cursor"))
testDs.Merge(ds.Tables("p_ref_data_cursor"))
testDs.Merge(ds.Tables("p_meas_typ_cursor"))
testDs.Merge(ds.Tables("p_measurement_period_cursor"))
testDs.Merge(ds.Tables("p_cap_typ_cursor"))
testDs.Merge(ds.Tables("p_pay_calc_mth_cursor"))
testDs.Merge(ds.Tables("p_calc_typ_cursor"))
testDs.Merge(ds.Tables("p_pay_freq_cursor"))
testDs.Merge(ds.Tables("p_payout_typ_cursor"))
testDs.Merge(ds.Tables("p_perf_source_cursor"))
testDs.Merge(ds.Tables("p_custom_type_cursor"))
ASKER
I am using merge syntax. Thank you Miguel.
ASKER
I am expecting the tempDS to be populated with filtered row of records and return in the function.
Is it possible to achieve in this syntax ??