Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8200293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:23:42+00:00 2026-06-07T06:23:42+00:00

I have a Content Type News with custom field NewsDate (DateTimeField) and Active (BooleanField)

  • 0

I have a Content Type “News” with custom field “NewsDate” (DateTimeField) and “Active” (BooleanField)

Now I’m need to get 3 active atimes order desc by NewsDate

Get all news, make them toList() and from there manipulate the data is not a solution.

P.S. I need to do something like:

        var items = contentManager
            .Query(Entities[PageType.Press])
            .OrderByDescending<CommonPartRecord, DateTime?>(record => record.PublishedUtc)
            .Slice(0, 3);

but instead of PublishedUTC use my custom field “NewsDate” and add Active == true, However it is not possible due to Orchard architecture of storing custom data in a separate field as XML data.

UPDATED:
In a nutshell I want to generate from code behind the following Query:

DECLARE @temp as TABLE(id int, xmldata xml)
INSERT @temp VALUES(1,'<Data><News><NewsDate>07/14/2011 11:42:00</NewsDate><Link Title="" DisplayText="" Link="www.example.com" OpenInNewTab="True">www.example.com</Link></News></Data>')
INSERT @temp VALUES(2,'<Data><News><NewsDate>07/11/2011 12:11:00</NewsDate><Link Title="" DisplayText="" Link="www.example.com" OpenInNewTab="True">www.example.com</Link></News></Data>')
INSERT @temp VALUES(3,'<Data><News><NewsDate>02/21/2012 16:56:00</NewsDate><Link Title="" DisplayText="" Link="www.example.com" OpenInNewTab="True">www.example.com</Link><NewsLink></NewsLink></News></Data>')

SELECT  
 TOP 3 [id],
[xmldata].value('(Data/News/NewsDate)[1]', 'datetime') as NewsDate
FROM @temp
ORDER BY NewsDate DESC

P.S. I looked through the code for DynamicContentQueryTests, however all the examples uses the Part, and in my case Fields are just in the ContentItem:
E.g. News content type contains NewsDate field (datetime field) and some parts as well

Any suggestions are greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T06:23:45+00:00Added an answer on June 7, 2026 at 6:23 am

    Querying fields is possible since 1.4 through Projector and underlying index tables and new APIs on Content Manager. Your simplest bet actually may be to create a projection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've defined a custom content type - news. I also have a menu item
I have ContainerWidget and custom container type with ShowAllLinkCaption field. Now I have only
I currently have a Content Type called News which is very simple (No custom
I have a 6 items of the same content type news, in each item
I have an archetype content type that previously was not folderish. Now I have
I have a custom content type create in visual studio 2010: custom http://img204.imageshack.us/img204/439/customf.jpg Here
I have a content type with a MediaPicker field in it. The MediaPicker allows
I have a content type Task, where we create task for ourself or user
I have a content type called fund. The contents of this is in node-fund.tpl.php
I have 3 content type HTML HTML4 HTML5 2 menu block HTML4 HTML5 In

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.