cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

Multi column Sort & Filter on Datatable

Hi folks. I have a simple datatable on a screen in my grocery shopping app.

 

This particular screen I'm simply displaying grocery items and store. I'm trying to get the datatable to sort ascending on both columns and filter the items to only those meeting the "need" criteria from aother column.

 

So this works to sort on store but not title, but filters to only items with status "need":

Filter(Sort(
      'Grocery Items',
       STORE_.Value,
       SortOrder.Ascending
),STATUS.Value="Need")

Here is the display:

SortGroceries.png

 

However, if I add a "+" to include sorting on "Title" as well with the following code, the filter works but sorting fell apart:

Filter(Sort(
      'Grocery Items',
       STORE_.Value + Title,
       SortOrder.Ascending
),STATUS.Value="Need")

SortGroceries1.png

 

I'm wanting it to sort by store then Title (grocery item). The next step will be to figure out how to simply email, text and/or printout the list.

 

Thanks

 

CW

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User
Dual Super User

Re: Multi column Sort & Filter on Datatable

Hi @CW 

 

Lookup columns show up as object on a data table

 

Try this - load your data into a collection first

On Visible of screen or on button click

 

 

ClearCollect(
colStoreInfo,
AddColumns(
Filter((Sort( Sort( 'Grocery Items', STORE_.Id ), Title )),STATUS.Value="Need"),
"Store Name",
STORE_.Value
)
)

 

 

Then use colstoreinfo as items for your data table and there use "Store Name" as a column

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

 

View solution in original post

6 REPLIES 6
Highlighted
Helper V
Helper V

Re: Multi column Sort & Filter on Datatable

This almost works but the store value is not showing:

Filter((Sort( Sort( 'Grocery Items', STORE_.Id ), Title )),STATUS.Value="Need")

SortGroceries2.png

Highlighted
Dual Super User
Dual Super User

Re: Multi column Sort & Filter on Datatable

Hi @CW 

 

Lookup columns show up as object on a data table

 

Try this - load your data into a collection first

On Visible of screen or on button click

 

 

ClearCollect(
colStoreInfo,
AddColumns(
Filter((Sort( Sort( 'Grocery Items', STORE_.Id ), Title )),STATUS.Value="Need"),
"Store Name",
STORE_.Value
)
)

 

 

Then use colstoreinfo as items for your data table and there use "Store Name" as a column

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

 

View solution in original post

Highlighted
Helper V
Helper V

Re: Multi column Sort & Filter on Datatable

Good idea, thanks Reza. I will attempt tomorrow.

 

CW

Highlighted
Dual Super User
Dual Super User

Re: Multi column Sort & Filter on Datatable

Hi @CW 

 

Hope it works

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

Highlighted
Helper V
Helper V

Re: Multi column Sort & Filter on Datatable

That worked excellent!!

 

Tx again Reza

Highlighted
Helper V
Helper V

Re: Multi column Sort & Filter on Datatable

Actually, although it worked, I can't connect a SP list connected Edit Form to edit line selections with this method.
 
Typical with Microsoft stuff. You can do this or that but if it's a Tuesday with a full moon, forget it. Then you have to scrap that idea and b;low everything away and try something else. When does it all end with this convoluted way of doing things????????????????????
 
CW

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (10,568)