Can we use 'group by' option in 'View' without providing the order input like 'ascending' or 'descending'?

Hi,

I want to show entries sort by ‘Entry Dates’ & group by ‘Customer Name’ without using any order like ascending or descending. I want to show latest entry in descending order at the same time multiple entries count of same customers in group by option so that I could know how many entries customer made with the same name. what I am getting is a sorted list of names ‘alphabetically sorted’ not as entry entry date.

0 17 1,341
  • UX
17 REPLIES 17

Grouping by its definition requires sorting.

That said I am not quite following what you want as your desired result. Could you type out a quick example of how you would like to see the data displayed?

Grouping by its definition requires sorting.

I’m curious how you came to this conclusion.

To give you an example of the frustration caused by having sort on group as a requirement, I have a project with phases and I want to display the tasks and group by the phases. How can I display the phases in the order they were entered into the app without having to concatenate a number to the phase string to group by?

It is not a conclusion, it is a fact of how grouping in a software system works. You asked how I came to this - it is based on a Computer Science degree and 25+ years of professional software development.

Grouping is more than just collecting like items together. One of the more prominent uses of Grouping is for computing Subtotals, Counts and other summary values.

The way this is done efficiently within software is to “collate” the items in a contiguous fashion - i.e. sort. Sorting works “fastest” when sorted in Ascending/Descending order.

The Grouping simply signals a “break” in the computations so the system “knows” when to stop the current summary calculations and begin the summary calcs for the next group. It does this by inspecting the value of the Grouped column as it processes each row and determining when the value changes.


The display issue and frustration you mention has always been there with Grouping. There is no good way around the sorting required. Unfortunately, if you want to display a Grouping order that is NOT Ascending/descending, you have to “build” into the data a way to “force” the sort the way you want.

I have seen systems that allow you to choose the order of these groupings but they simply add the custom sorting for you behind the scenes.

EDIT: Disregard my proposed solution below. As Steve points out in the next post, for Ref columns, the Label value is used to sort/group by. There is currently no way to circumvent that. The only way to sort differently than alphabetically is to append some value to the group or sort field that creates the sort order you desire - e.g. “1-xxx”, “2-xxx”, etc.

For Ref columns, you would append to the column tagged as the Label.


By the way, to answer your question of how to handle the custom sort,

I would create a Phase name table that uses a numeric code - 1,2,3, etc that specifies the order of the Phases. The Phase Name is the label.

Then from your data row join to this Phase Table through a Ref column. You can sort/group by this column and it will use the code value for the sorting - at least I think so. When it is displayed it will use the column tagged as the label for display.


“[T]he order they were entered into the app” is in fact a sorting order, so you are requesting your groups be sorted, just not by the display value. Unfortunately, there is no way to display a value that differs from the sort key for group labels.

I stand corrected. Steve is right.
Grouping on a Ref column sorts it by the column tagged as Label. Therefore my proposed solution above will not work. Sorry for the confusion

I’ve seen several requests for a “custom” sort. Its probably time to submit a request to enhance it. We have a Label value specified for Ref columns, why not be able to specify the sort column?

One other minor note. The specified Group columns become the top level sort order. In the editor, I would switch the order of the Group and Sort properties in the view. And maybe include a note to clarify Grouping becomes top level sorting.

If u need to display a list phases basis, you have to create a separate table with Ref and assing a step number to the phases, like:
Open / 1
Going on / 2
Ending / 3
Close / 4

Than in the UX use “sort by” [phase] instead “group by”.

so, how to resolve this issue can some one please write the code for it or navigate as I am new into coding.

What I am trying to do is-
I have many entries on daily basis, with some new & some repeated customers with multiple entries. so I those multiple entries in ‘gorup by’ so that I could know a particular customer has more than one entry by seeing entry count & I want to sort those entries by ‘entry dates’. but sorting option is coming with ‘ascending-descending’ order option, selecting one resulting in sort the list as ‘alphabatically sort’ instead of ‘entry date’ wise sort

Make the Entry Date column type Date. Group by Entry Date in Ascending order.

But by doing so, I won’t be able to count the entries made by same client saveral times

Correct. So that doesn’t work for you. When you Group by Customer and Sort by Date in descending order, why doesn’t that work for you?

Because it is taking descending or ascending order alphabetically in name first. Like regardless of dates it is showing ‘A’ names first with dates descending order, than ‘B’ name with dates descending order.
I want it to sort by dates only,

Ok, I DO understand what you mean. But, In the quote below you mentioned multiple entries and being able to see the count by Customer.

Is that a count for that customer on the SAME day or a total count for ALL days?

Entries are for all dates.

Sorry. I am asking when you show the count by customer are you only interested in the count for that SAME day or do you want to see the count of ALL the entries that customer has ever made?

I’ll assume you want to see the count by customer for ALL entries they have ever made. If so, There is a contradiction with your Group request.

You cannot use a Group function to show all entries by Date order AND show a Group by Customer to get a count of ALL entries he/she has ever made.

There are two suggestions I can make:

  1. Put together a Dashboard view that shows 2 views. The first is Sorted (and maybe even grouped) by date so you can see who made entries on each date. The second is grouped by Customer showing the total count of all entries made by each Customer.

  2. You could keep an updated count with each customer. Sort (maybe group) by date and show that count as part of the detail. This would mean that a customer is shown multiple times, each date he/she made an entry, and the Count is replicated on each of those rows.

Out of curiosity, and I’ll admit I only skimmed some of this, what does it look like if you Group By date and then sort by customer? That should do the opposite. Should be descending dates and then the names under each date. Wouldn’t that be closer to the solution you want? Or does it end up just not displaying the way I’m thinking? You would just need to find an alternative to the counting part.

Yes, that is basically what I suggested in #2 in the prior post, including the suggestion of a way to show the count in a different way.

Top Labels in this Space