Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I used the query builder to generate the query for my page and my question is can I do like SQL and select top 5 items from the list in the code below ? or how would I achieve this.
thanks
@{ var blogitems = Umbraco.Content(Guid.Parse("SOMEGUID")) .ChildrenOfType("blogItems") .Where(x => x.IsVisible()) .OrderByDescending(x => x.CreateDate); }
Hi Pierre,
Before the ; you can add .Take(5) which will take the up to the first 5 items in the list.
https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.take?view=netframework-4.7.2
Matt
Thanks that worked and thanks for the reference link
cheers
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Umbraco TOP 5 Query
I used the query builder to generate the query for my page and my question is can I do like SQL and select top 5 items from the list in the code below ? or how would I achieve this.
thanks
@{ var blogitems = Umbraco.Content(Guid.Parse("SOMEGUID")) .ChildrenOfType("blogItems") .Where(x => x.IsVisible()) .OrderByDescending(x => x.CreateDate); }
Hi Pierre,
Before the ; you can add .Take(5) which will take the up to the first 5 items in the list.
https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.take?view=netframework-4.7.2
Matt
Thanks that worked and thanks for the reference link
cheers
is working on a reply...