Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • radmanmm 117 posts 108 karma points
    May 29, 2014 @ 15:25
    radmanmm
    0

    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.

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    May 31, 2014 @ 07:47
    Jeavon Leopold
    0

    I'm not quite sure what you mean, could you post your code?

  • radmanmm 117 posts 108 karma points
    Jun 04, 2014 @ 19:57
    radmanmm
    0

    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>

            }

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jun 04, 2014 @ 20:08
    Jeavon Leopold
    0

    Can you post how the variable selection is created?

  • radmanmm 117 posts 108 karma points
    Jun 06, 2014 @ 20:50
    radmanmm
    0

    var selection = Model.BacklogItem.Where("Visible");

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jun 07, 2014 @ 08:24
    Jeavon Leopold
    0

    Something like this then?

    var selection = Model.BacklogItem.Where("Visible").OrderBy("devCellcol4")

  • radmanmm 117 posts 108 karma points
    Jun 09, 2014 @ 15:59
    radmanmm
    0

    So I can order by the Div id?

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Jun 17, 2014 @ 20:37
    Jeavon Leopold
    0

    I'm not sure I understand...?

  • Charles Afford 1163 posts 1709 karma points
    Jun 18, 2014 @ 22:01
    Charles Afford
    0

    @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

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  • radmanmm 117 posts 108 karma points
    Aug 04, 2014 @ 19:59
    radmanmm
    0

    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

  • radmanmm 117 posts 108 karma points
    Aug 04, 2014 @ 20:10
    radmanmm
    0

    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));

Please Sign in or register to post replies

Write your reply to:

Draft