Hi
Thanks for the reply. The code failed with an exception object null. I removed the null parameter and the code completed but with the following SQL, which didn;t seem to be different from my version, (the where clause being the same). I can see how to create an expression but cant see how to compare an expression to a static number instead of another expression or field,
FYI I am using self servicing.
Query: SELECT COUNT(*) AS NumberOfRows FROM (SELECT DISTINCT [mallett_WMS01].[Customer].[c_id] AS [C_id], [mallett_WMS01].[Customer].[c_guid] AS [C_guid], [mallett_WMS01].[Customer].[c_title] AS [C_title], [mallett_WMS01].[Customer].[c_firstname] AS [C_firstname], [mallett_WMS01].[Customer].[c_surname] AS [C_surname], [mallett_WMS01].[Customer].[c_email] AS [C_email], [mallett_WMS01].[Customer].[c_phone] AS [C_phone], [mallett_WMS01].[Customer].[c_mobile] AS [C_mobile], [mallett_WMS01].[Customer].[c_created] AS [C_created], [mallett_WMS01].[Customer].[c_notes] AS [C_notes], [mallett_WMS01].[Customer].[c_update_requested] AS [C_update_requested], [mallett_WMS01].[Customer].[ct_id] AS [Ct_id], [mallett_WMS01].[CustomerType].[ct_id] AS [Ct_id], [mallett_WMS01].[CustomerType].[ct_ref] AS [Ct_ref], [mallett_WMS01].[CustomerType].[ct_description] AS [Ct_description], [mallett_WMS01].[CustomerOption].[cop_id] AS [Cop_id], [mallett_WMS01].[CustomerOption].[cop_checkoptions] AS [Cop_checkoptions], [mallett_WMS01].[CustomerOption].[cp_searchoption1] AS [Cp_searchoption1], [mallett_WMS01].[CustomerOption].[cp_searchoption2] AS [Cp_searchoption2], [mallett_WMS01].[CustomerOption].[cp_searchoption3] AS [Cp_searchoption3], [mallett_WMS01].[CustomerOption].[cp_searchoption4] AS [Cp_searchoption4], [mallett_WMS01].[CustomerOption].[cp_searchoption5] AS [Cp_searchoption5], [mallett_WMS01].[CustomerOption].[cp_searchoption6] AS [Cp_searchoption6], [mallett_WMS01].[CustomerOption].[c_id] AS [C_id] FROM (( [mallett_WMS01].[CustomerType] INNER JOIN [mallett_WMS01].[Customer] ON [mallett_WMS01].[CustomerType].[ct_id]=[mallett_WMS01].[Customer].[ct_id]) INNER JOIN [mallett_WMS01].[CustomerOption] ON [mallett_WMS01].[Customer].[c_id]=[mallett_WMS01].[CustomerOption].[c_id]) WHERE ( [mallett_WMS01].[CustomerOption].[cop_checkoptions] = [mallett_WMS01].[CustomerOption].[cop_checkoptions] & @LO23821))
Walaa wrote:
I think the following may do the trick, please try it:
filter.Add(new FieldCompareExpressionPredicate(
EntityFieldFactory.Create(CustomerOptionFieldIndex.Cop_checkoptions), null,
ComparisonOperator.Equal,
new Expression(EntityFieldFactory.Create(CustomerOptionFieldIndex.Cop_checkoptions), ExOp.BitwiseAnd, 8)));