I have Tests and Methods Lists.
Tests:
TestName
- Test1
Methods: MethodName, TestName(look up wit
Method1, Test1
Method2, Test2
TestName)
I want to filter methods with caml query by lookup value.
var metodList = web.Lists["Methods"];
query.Query = @"<Where><Eq><FieldRef Name='TestName'/>
<Value Type='Lookup'>Test1</Value></Eq></Where>";
var metods = metodList.GetItems(query);
foreach (SPListItem metodItem in metods.List.Items)
{
metodViewModelList.Add(new MetodViewModel
{
MetodId = Convert.ToInt32(metodItem["ID"]),
MetodName = metodItem["MethodName"].ToString()
});
}
But it isn't working. metods.List.items has two items. Method2 is coming too.
Where am i doing wrong?