Developer forum

Forum » CMS - Standard features » Documentation on Filter for RenderItem

Documentation on Filter for RenderItem

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I am trying to use the Filter functionality when calling RenderItem directly in the template.

I know there are 2 approaches to this filter: SQL (or code) and the implemented filter from front end.

Since I bneed to use "Contains" I suppose I need to use the latter.

However, I could not find any documentation on how to build the filter string correctly.

What I need to buils is "Field1 is Value1 and Field2 contains Value2".

I tried this syntax exactly and it does not seem to work.

I am using 9.2.8.

Thanks,

Adrian 


Replies

 
Nicolai Pedersen
Reply

Hi Adrian

Do you mean RenderItemList? That is found here: http://doc.dynamicweb.com/documentation-9/content/items/item-publisher#3297

BR Nicolai

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

Yes, that's the one. Sorry for being vague.
As you can see, in the page you mentioned, there is not clarification on how to write a filter to be used directly in the template.

There is a parameter that is not documented: ListFilter.

While Filtering by querystring is pretty useful, it does not account for the ListFilter syntax.

That's what I am missing.

I hope it makes sense.

Thanks,

Adrian

 
Nicolai Pedersen
Reply

Hi Adrian

Something like this?

@{
var areaId = GetInteger("…");
if (areaId > 0) {
  @RenderItemList(new {
    ItemType = "Contact",
    ListSourceType = "SelfArea",
    ItemFieldsList = "*",
    ListTemplate = "ItemPublisher/List/List.cshtml",
    ListPageSize = 10,
    ListOrderBy = "Name",
    Filter = "Areas contains \""+areaId+"\""
  });
}
}
 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

Exactly that one.

Thanks,
Adrian

 

You must be logged in to post in the forum