1

Closed

camlex cannot be translated into caml workflow status (WorkflowStatus)

description

Hi

this is excellent framework for CAML.
i got a small problem while i implement Camlex.

var exp = new List<Expression<Func<SPListItem, bool>>>();

exp.Add(x => ((CamlexNET.DataTypes.WorkflowStatus)x[status] == (CamlexNET.DataTypes.WorkflowStatus)ddlStatus.SelectedValue));


the dropdown list values are 2, 16, 17

in run time its giving the error

camlex cannot be translated into caml workflow status

Expression 'x => (Convert(x.get_Item(value(List_View_Filter_WebPart.VisualWebPart1.VisualWebPart1UserControl+<>c__DisplayClass0).status)) = Convert(Convert(value(ASP._controltemplates_list_view_filter_webpart_visualwebpart1_visualwebpart1usercontrol_ascx).ddlStatus.SelectedValue)))' can not be translated into CAML
Closed Feb 14, 2013 at 8:07 PM by sadomovalex

comments

sadomovalex wrote Feb 14, 2013 at 8:07 PM

hi
you need to use string-based syntax - see here. I.e. in your example it should be like this:
string s = CamlexNET.Camlex.Query().Where(x => (x["status"] == (CamlexNET.DataTypes.WorkflowStatus)ddl.SelectedValue)).ToString();
It will produce the following Caml:
<Where>
  <Eq>
    <FieldRef Name="status" />
    <Value Type="WorkflowStatus">1</Value>
  </Eq>
</Where>

kavalirakesh wrote Feb 15, 2013 at 6:33 AM

excellent product and excellent support.
its working.