cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CW
Post Patron
Post Patron

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
RezaDorrani
Dual Super User II
Dual Super User II

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
CW
Post Patron
Post Patron

This almost works but the store value is not showing:

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

SortGroceries2.png

RezaDorrani
Dual Super User II
Dual Super User II

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

Good idea, thanks Reza. I will attempt tomorrow.

 

CW

RezaDorrani
Dual Super User II
Dual Super User II

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

That worked excellent!!

 

Tx again Reza

CW
Post Patron
Post Patron

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (51,636)