grouping

ListViewGroup not sorting correctly

I'm using a ListView control in a C# WinForms application. Items in the list are added to a ListViewGroup (in this case, grouping by country). The one thing that isn't working as expected is that the column sorting appears to be strange. I've hooked into the ListViewItemSorter property of the ListView and everything sorts perfectly exce...

WPF : CollectionViewSource displaying grouped by Property

In Xaml, suppose I have a CollectionViewSource who's source is set to observable collection of objects of type Order: public class Order { public int ContractID { get; set; } public double? Price { get; set; } public OrderSide Side { get; set; } } public...

Linq Nested Grouping

I've a large table of Items and I need to organize them by Category, then by Year and then by Month. Item has CategoryID and Dated properties. I got this far: Dim Items = From Item In DB.Items _ Group By CategoryID = Item.CategoryID _ Into Categories = Group _ Order By CategoryID But where I put the: ...

awk extract multiple groups from each line

How do I perform action on all matching groups when the pattern matches multiple times in a line? To illustrate, I want to search for /Hello! (\d+)/ and use the numbers, for example, print them out or sum them, so for input abcHello! 200 300 Hello! Hello! 400z3 ads Hello! 0 If I decided to print them out, I'd expect the output of 20...

SSRS Grouping multiple tables based on Multi Value parameter

I have a report containing seven tables, each table returning a different set of values for a list of id's selected in a parameter list. I have the tables enclosed in a rectangle so that they print together. Now I would like to group the results based on the id passed in from the multi-select parameter. So if I have a list of four ids i...

GROUP BY for continuous rows in SQL

Given the following table: ID State Date 12 1 2009-07-16 10:00 45 2 2009-07-16 13:00 67 2 2009-07-16 14:40 77 1 2009-07-16 15:00 89 1 2009-07-16 15:30 99 1 2009-07-16 16:00 Question:How can i GROUP by the field "State", while still maintaining the borders between the state changes? SELECT...

Grouping tables in SQL SERVER

Hello everyone, How do I group a set of tables or label them together? In our project,each user has two separate tables allocated for them. I need to group all users tables separately. How do I accomplish this? Thanks. ...

How do I group these XDocuments?

Problem I have a collection of XDocument instances. Each document has a repeated element that can take a different value. I want to group them by this value but each element can specify a different value. <sampledoc> <value>a</value> <value>b</value> <value>c</value> </sampledoc> Example Document A has values a, b, c Document...

How do i find the total number of records created on a given day using T-SQL?

I need to find out the total number of records that were created on a given day. e.g. ID CreatedDate 1 17/07/2009 2 12/07/2009 3 17/07/2009 4 05/07/2009 5 12/07/2009 6 17/07/2009 Output: 3 Records were created on 17/07/2009 2 Records were created on 12/07/2009 1 Record was created on 05/07/2009 EDIT Upon testing the second su...

PHP SimpleXML Group By Element Type

Ok here's my dilemma. I am looking for a way to consolidate the data in a group using SimpleXML in PHP. Here's what I mean. Let's say I have an xml that looks like this: <favorites> <interesting> <type>Movie</type> <character>James Bond</character> <name>Casino Royale</name> </interesting> <interes...

grouping with order?

In WPF, I can group, but the default is group with ascending. One of my need to to be able to control the sorting of the group (Ascending or descending). For example: group 1 item 1.1 item 1.2 item 1.3 group 2 item 2.1 item 2.2 and also be able to switch to: group 2 item 2.1 item 2.2 group 1 item 1.1 item 1.2 item...

Ext JS GroupingStore group DateTime column by just date?

I have an Ext GroupingStore on a list of orders. One of the columns is a DateTime. I would like the user to be able to group by the DateTime column and have all days under one group. At the moment, each date, hour, minute and second is one group... not very useful :-) Any way short of two columns to accomplish this? ...

splitting a group by preferences

Am a C# rookie trying to help a friend programatically take a group of twenty people (labelled 1 - 20) and spilt them into five subgroups of four each based upon expressed preferences of who those people wish to be with. Each person in the group of 20 could express 0, 1, 2, 3, or 4 preferences. For example, person 1 could select 0 (no ...

Linq: How to group by maximum number of items

CONTEXT I have a list of items (or arbitrary length). I'd like to group them in 'chunks' of a certain size Example: I have 12 customers [0,1,2,3,4,5,6,7,8,9,10,11] and want to group themin chunks of 5 which would give [0,1,2,3,4] [5,6,7,8,9] [10,11] NOTE: In reality I am not working with customers or monotonically increasing integers. ...

Javascript Dynamic Grouping

I am trying to create a table, with some grouping headers. All is well when i have 1 group, but how do i create dynamic groups? This is what i have so far (for 1 group): var groupby = ''; arrdata.each(function(element){ if (groupby != element.groupby) { groupby = element.groupby; tbody.push(groupby) } tbody.push(e...

Oracle SQL for continuous grouping.

I need to generate a report from a table with the structure and data as given below. Table Ticket has data as given below. ID Assigned_To 100 raju 101 raju 102 raju 103 anil 104 anil 105 sam 106 raju 107 raju 108 anil The Oracle SELECT should generate the below report Fro...

Need Algorithm to group files of varying sizes into approximately equal blocks

Hey folks, I'm trying to figure out an algorithm that will help me group an assortment of files of varying sizes into say, 'n' groups of approximately equal size. Any ideas on how to achieve this? ...

How to group items by index? C# LINQ

Suppose I have var input = new int[] { 0, 1, 2, 3, 4, 5 }; How do I get them grouped into pairs? var output = new int[][] { new int[] { 0, 1 }, new int[] { 2, 3 }, new int[] { 4, 5 } }; Preferably using LINQ ...

Grouping rows in ASP.Net ListView

I am new to ASP.NET. I am trying to display my sql results using a list view. I am using the example for grouping my results by a data field from the 4GuysFromRolla.com website. However, I find the way of grouping the items by a data field to be a bit clumsy. Is there a better way to do it? Thanks. ...

Linq inner join grouping

I'm trying to create an expression tree dynamicly. Let asume that I have two simple classes: class CustomerType { public int Id { get; set; } public string Name { get; set; } public OrderType[] Orders { get; set; } } class OrderType { public int Id { get; set; } public DateTime Date { get; set; } public decimal Pric...