I have created a custom events module that has tags for events and the ability to filter by tags. I have the code for that working just fine. What I am getting hung up on is filtering by multiple tags. See my code below:
public IEnumerable<Event> ListEventsByMultipleTags(string tags)
{
IEnumerable<Event> t;
using (IDataContext ctx = DataContext.Instance())
{
EventListController elc = new EventListController();
t = ctx.ExecuteQuery<Event>(CommandType.Text, "WHERE PortalID = @0 AND EventId IN (SELECT EventId FROM [Events_EventTag] WHERE TagId IN (@1)) AND EndDate >= @2", 0, issue, DateTime.Today).ToList();
}
return t;
}
The string tags is a comma delimited string of tag ids, which is the basis for the filter WHERE TagId IN (@1) . I haven't seen any good examples to follow for this type of selection. It's probably easy, and I'm just missing it. Essentially the sql should be like WHERE TagID in(1,2,3)