1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Column 'p6' does not belong to table MetaDataQuery.

Column 'p6' does not belong to table MetaDataQuery.

2 posts, 0 answered
  1. gopalraman gopal
    gopalraman gopal avatar
    52 posts
    Registered:
    03 Dec 2009
    28 May 2010
    Link to this post
    Hi

    here i am trying to get news item by passing category and subcategory news.

    i am getting the following error can u just help me?

    "Column 'p6' does not belong to table MetaDataQuery."

      IMetaSearchInfo[] filters = new IMetaSearchInfo[5];
            filters[0] = new MetaSearchInfo(MetaValueTypes.DateTime, "Expiration_Date", DateTime.Now, SearchCondition.GreaterOrEqual);
            filters[1] = new MetaSearchInfo(MetaValueTypes.ShortText, "Title", "", SearchCondition.NotNull);
            filters[2] = new MetaSearchInfo(MetaValueTypes.ShortText, "Category", "CategoryName");
            filters[3] = new MetaSearchInfo(MetaValueTypes.ShortText, "Category", "SubCategoryName1");
            filters[4] = new MetaSearchInfo(MetaValueTypes.ShortText, "Category", "SubCategoryName2");

            IList lstListOfNewsItems = objNews.Content.GetContent("Publication_Date DESC", filters);


    Thanks
    G.GopalRaman
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    28 May 2010
    Link to this post
    Hi gopalraman gopal,


    You could use GetCategoriesTree method of the ContentManager class, loop through all sub categories and build the filter.

    var Manager = new ContentManager("News");
    Guid categoryId = new Guid("C1ED4A0F-E6CD-4b92-B620-8E69000E62B7");
    var rootCategory = Manager.GetCategory(categoryId);
    IList categoriesTree = Manager .GetCategoriesTree(rootCategory);
    List<IMetaSearchInfo> filter = new List<IMetaSearchInfo>();
    foreach (ICategory c in categoriesTree)
    {
        filter.Add(new MetaSearchInfo(MetaValueTypes.ShortText, "Category", c.CategoryName));
    }
    IList cntItems = nm.GetContent(0, 0, "Expiration_Date ASC", filter.ToArray());


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
2 posts, 0 answered