Create Dynamic Links to Group the Same Table View BY ANY COLUMN!

Table views (and a few other types) have a ‘Group by’ option, to group rows by a certain column.

But if you wanted to view the same set of rows with a different grouping, you have to create a new view for each ‘Group by’ setting. Or do you?


I noticed ‘&group=’ in the URL of one of my views, followed by percent signs and other parameters (URL encoding).

The decoded format looks like this:
&group=[{"Column":"county_name","Order":"Ascending"}]

So if you replace county_name with the column name you want to group by, and ENCODEURL() the new string, you can add that to the end of a LINKTOVIEW(TableView).

I added a new table with one row for every column name, then pass that value to an action.

This allows for using a single table view and a single action to dynamically navigate to a table view that is grouped by any column!

I have added this functionality to my US States public sample app.

https://www.appsheet.com/samples/Sample-app-with-US-zip-codes?appGuidString=d6ab1dec-d053-4920-9c74-...

17 16 2,468
16 REPLIES 16

Probably should ENCODEURL() the [ColumnName] too. I try to avoid spaces and special characters in column names so things like that aren’t an issue. But I think it would be a problem with the wrong column names.

Man you’re on a roll!

Sometimes I can’t get this stuff out of my head until I post it lol.

This one, in particular, was screaming at me while I was trying to work today.
“THE PEOPLE MUST KNOW OF THIS DISCOVERY!”

Do these kind of link hacks work on mobile as well?

Yes. I just confirmed on mobile using the sample app.

Nice!
The link is fun to play with… All sorts of interesting nuggets in there.

Great tips thank you!

I belive you managed to simplify the tips previously introduced by Appsheet team

Bahbus
New Member

This behavior would also somewhat explain why it was (a while ago) setting a group by on a view and then switching to a different view type that didn’t have grouping setup on the front-end editor would be what I called “sticky grouped”.

Thank you @GreenFlux
Deep Links are really a key to much more things in AppSheet.
I was thinking about opening a new Post to collect all Deep Link Tips…

Yeah, I was thinking about a post listing all the optional URL parameters, like &group=,&at=NOW()+1, &quickedit=true, etc. I can add those to your post if you want to start a new tread for it.

So cool. If you like you can start the post and I can contribute

Ok, I started a list of Deep Links and URL parameters. It could use some examples for LINKTOFILTEREDVIEW() or maybe linking to another app.

If you want to group by multiple columns at once (for drill-down grouping), the syntax is like this:

& "&group="
& ENCODEURL( '[
    {"Column":#col1#,"Order":"Ascending"} ,
    {"Column":#col2#,"Order":"Ascending"} ,
    ...
]' 

Hi @GreenFlux @Marc_Dillon is it possible to show the GROUP AGRREGATE (COUNT) along with the "&group="column_name"

It doesn't look like anything in the URL controls the group aggregate display, but you can set that config in the view itself, ahead of time, even if there aren't any groupings.

Thank you 😊

Top Labels in this Space