cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
CW
Level: Powered On

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
Super User
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

 

 

6 REPLIES 6
CW
Level: Powered On

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

Super User
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

 

 

CW
Level: Powered On

Re: Multi column Sort & Filter on Datatable

Good idea, thanks Reza. I will attempt tomorrow.

 

CW

Super User
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

CW
Level: Powered On

Re: Multi column Sort & Filter on Datatable

That worked excellent!!

 

Tx again Reza

CW
Level: Powered On

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
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 172 members 3,871 guests
Please welcome our newest community members: