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
Hello,
I need to know how to fill a sorted list with the collection that comes back from Model.Children so that I can create custom sort criteria.
Thanks.
I'm not quite sure what you mean, could you post your code?
Sure, I want to sort the list by formula used in the Priority column (aka devCellcol4)...
@foreach(var page in selection)
{
<div class="divRow">
<div class="divCellcol1"><a href="@page.Url" target="_blank">@page.itemNumber</a></div>
<div class="divCellcol2">@page.name</div>
<div class="divCellcol3">@page.requestingTeam</div>
<div class="divCellcol4">@((page.businessValue * (page.effort/averageVelocity)))</div>
</div>
}
Can you post how the variable selection is created?
var selection = Model.BacklogItem.Where("Visible");
Something like this then?
var selection = Model.BacklogItem.Where("Visible").OrderBy("devCellcol4")
So I can order by the Div id?
I'm not sure I understand...?
@radmanmm
You cannot sort by div id but i think i see what you are trying to do. You should be able to do something like:
var selection = Model.BacklogItem.Where("Visible").OrderBy(x=>x.businessValue * (x.effort/x.averageVelocity))
This should return a collection of visible backlog items ordered by your equation.
Charlie
Charlie,
I get this error when I try to use the code you have provided. I am not sure what I would need to cast it to.
e:\Websites\LTTv\MacroScripts\635427570183199635_PrioritizedProductBacklog.cshtml(14): error CS1977: Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree typeSaving scripting file failed: e:\Websites\LTTv\MacroScripts\635427570183199635_PrioritizedProductBacklog.cshtml(14): error CS197
Also, average velocity would not be part of the page properties, but would be a variable in the script. Like this:
var averageVelocity = 82;
var selection = Model.BacklogItem.Where("Visible").OrderBy(x=> x.businessValue * (x.effort/averageVelocity));
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
SortedList in Razor
Hello,
I need to know how to fill a sorted list with the collection that comes back from Model.Children so that I can create custom sort criteria.
Thanks.
I'm not quite sure what you mean, could you post your code?
Sure, I want to sort the list by formula used in the Priority column (aka devCellcol4)...
@foreach(var page in selection)
{
<div class="divRow">
<div class="divCellcol1"><a href="@page.Url" target="_blank">@page.itemNumber</a></div>
<div class="divCellcol2">@page.name</div>
<div class="divCellcol3">@page.requestingTeam</div>
<div class="divCellcol4">@((page.businessValue * (page.effort/averageVelocity)))</div>
</div>
}
Can you post how the variable selection is created?
var selection = Model.BacklogItem.Where("Visible");
Something like this then?
var selection = Model.BacklogItem.Where("Visible").OrderBy("devCellcol4")
So I can order by the Div id?
I'm not sure I understand...?
@radmanmm
You cannot sort by div id but i think i see what you are trying to do. You should be able to do something like:
var selection = Model.BacklogItem.Where("Visible").OrderBy(x=>x.businessValue * (x.effort/x.averageVelocity))
This should return a collection of visible backlog items ordered by your equation.
Charlie
Charlie,
I get this error when I try to use the code you have provided. I am not sure what I would need to cast it to.
e:\Websites\LTTv\MacroScripts\635427570183199635_PrioritizedProductBacklog.cshtml(14): error CS1977: Cannot use a lambda expression as an argument to a dynamically dispatched operation without first casting it to a delegate or expression tree typeSaving scripting file failed: e:\Websites\LTTv\MacroScripts\635427570183199635_PrioritizedProductBacklog.cshtml(14): error CS197
Also, average velocity would not be part of the page properties, but would be a variable in the script. Like this:
var averageVelocity = 82;
var selection = Model.BacklogItem.Where("Visible").OrderBy(x=> x.businessValue * (x.effort/averageVelocity));
is working on a reply...