Need to run a query on a Datatable to fetch results based on a String search, is there a way to setting the search/query done on a Datable as caseinsensitive ?
@mailsmithash Yes, It might be possible based on what you want to Achieve
Setting the datatable.CaseSensitive = False, property and testing it
@mailsmithash Yes, But what is your test Case? You might just need the Case Sensitive or Insensitive Comparison for only performing some specific operation, In that case we can use Linq query to Compare the Values ignoring the case and Retrieve the Output you need.
Comparing Bank names in a Bank Statement , here the Bank Names may come as upper case, lower case or a mix of both. So searching for the Bank name string in the Datatable column which has Bank details. Using “LIKE” in the select query on the Datatable. This is the use case.
You can use linq query like this.
Converting both values to to lower or upper and compare it.
The query that i am executing on the Datatable compares two other values amount and Branch , Here ‘depositBranch’ is the one which may come in any combination of cases,
Won’t setting the Datatable property to acntDT.CaseSensitive = False solve the issue
As the query will get complex with converting both to lower or upper case, unless there is no other approach in uipath.
acntDT.Select("[Narration] Like ‘%"+depositBranch+"%’ And [Deposit Amt.]="+amount+“AND [Narration] Like ‘%CASH%’” )
Tested the Datatable.CaseSensitive = False, it seems to work without modifying the query, by default the Datatable.CaseSensitive property is coming as false, setting it to ‘True’ is doing a case sensitive search. So modifiying the property of CaseSensitive to false is solving the issue without modification of query.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.