Copied to clipboard

Flag this post as spam?

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


  • Sean Dooley 273 posts 490 karma points
    Mar 19, 2012 @ 12:39
    Sean Dooley
    0

    Linq to iterate nodes, split & group a comma separated string UltimatePicker value

    Wondering if anyone has an idea of how to use a Linq statement that iterates over a collection of nodes, splits a comma separated string UltimatePicker value, groups the split values and returns a count of each grouped valued.

    The UltimatePicker values are stored as "1021,1022,1023,1024", which needs to be split then grouped.

    Below is an example of grouping by year and month.

    var groupedNodes =
            from p in nodes
            group p by p.GetPropertyValue("PostDate").AsDateTime().Year into yg
            orderby yg.Key descending
            select
                new
                {
                    Year = yg.Key,
                    Months =
                        from m in yg
                        group m by m.GetPropertyValue("PostDate").AsDateTime().Month into mg
                        select
                            new
                            {
                                Month = mg.Key,
                                Posts = mg
                            }
                };

    Thank you for any help.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies