[DevExpress Support Team: CLONED FROM K18434: How to convert the CriteriaOperator to the corresponding filter string in order to use it for building SQL queries or for filtering the DataView]
This is a really cool function but i have one problem.
When i convert to a sql-String, the string will contain the displayname instead of the database name , any idea ?
Thanks
CriteriaToWhereClauseHelper.GetDataSetWhere returns a string that contains the displayname instead of the database name
Answers approved by DevExpress Support
Hello Chris,
Neither the CriteriaToWhereClauseHelper.GetDataSetWhere method nor the CriteriaOperator object contains information about display names specified in the business class or in a control. So, the issue is likely in data passed to the CriteriaOperator. It likely contains display names instead of property names. Ensure that you are obtaining or building this CriteriaOperator correctly. If you cannot find the reason, please provide a sample project reproducing the issue.
So, whata do i do :
I have a grid, bound to a xpcollection. Grid will show Displayname of course.
Now i use this code:
Dim op As CriteriaOperator = GridView1.ActiveFilterCriteria
Dim filterString As String = DevExpress.Data.Filtering.CriteriaToWhereClauseHelper.GetMsSqlWhere(op)
And the filterstring will contains Displaynames instead of datafields.
That´s all, i don not need to make an example for it, right ? :-)
Probably the CriteriaOperator is passed to the grid control in a specific manner. I have not managed to reproduce the issue with filters that can be created in the user interface. See my test project in the attachment.