cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Sort by several columns or some other solution?

Hello!

 

Right now in my gallery I sort on an text column where my colleges insert todays date and time. My gallery in sorted descending on this column.

 

The problem is when the app get more than 500 objects is about for example 5 days, that object with the status "Transfer to future date" will dissapear. I dont want more than 500 objects at once in the app because of performance issues if its above that threeshold.

 

So to the question: Is there anyway to sort on the "Status" in secondhand somehow? SortByColumns or something? I want to object with the status "Transfer to future date" to always be visible in my app no mather what.

 

This is the sortfunction I use now:

Filter(
        Sort(
            Logg;
            'Case received';
            Descending
        )

 

Appreciate the help, thanks!

13 REPLIES 13

Hi @Anonymous :

 No error indicates that the logic of the formula is correct, and we are close to success.I suggest you try to execute this command in stages to ensure that the formula can be delegated.For example:

Set(ManuellUppdateringSpinner;true);; 
ClearCollect(
 CollectLogg;
 Sort(
  Filter(
    'Logg';
    Status.Value = "Transfer to future date"
  );
  'Case Received';
  Descending
 );
);;
Collect(
 CollectLogg;
 Sort(
  Filter(
    'Logg';
    Status.Value <> "Transfer to future date"
  );
  'Case Received';
  Descending
 );
);;
Set(ManuellUppdateringSpinner;false))

If this formula fails to get a result, I suggest you check whether

Filter('Logg';Status.Value = "Transfer to future date");

can get a result.

Best Regards,

Bof

 

Anonymous
Not applicable

Hello!

 

I tried: 

 

Filter('Logg';Status.Value = "Transfer to future date")

 

in the gallery without clearcollect and there is no delegation warnings, works just fine.

 

Then I tried your code, and I get errors on the "););;" part and delegation warning on "Status.Value <> "Transfer to future date"":

 

Set(ManuellUppdateringSpinner;true);; 
ClearCollect(
 CollectLogg;
 Sort(
  Filter(
    'Logg';
    Status.Value = "Transfer to future date"
  );
  'Case Received';
  Descending
 );
);;
Collect(
 CollectLogg;
 Sort(
  Filter(
    'Logg';
    Status.Value <> "Transfer to future date"
  );
  'Case Received';
  Descending
 );
);;
Set(ManuellUppdateringSpinner;false))

 

 

Hi @Anonymous :

Sorry ,I made a mistake.You shour remove the ";":

Set(ManuellUppdateringSpinner;true);; 
ClearCollect(
 CollectLogg;
 Sort(
  Filter(
    'Logg';
    Status.Value = "Transfer to future date"
  );
  'Case Received';
  Descending
 );
);;
Collect(
 CollectLogg;
 Sort(
  Filter(
    'Logg';
    Status.Value <> "Transfer to future date"
  );
  'Case Received';
  Descending
 )
);;
Set(ManuellUppdateringSpinner;false))

In theory, <> supports delegation for the complex field in the SharePoint List. I'm not sure what caused the warning(Maybe because Collect is not delegable), but even if it can't be delegated, this formula should already meet your requirements.

Best Regards,

Bof

Anonymous
Not applicable

@v-bofeng-msft I think this almost worked, I think we are close.

 

It still gives delegation warning on the <>part. I had to remove another ";" to make it work. My code looks like this:

Set(ManuellUppdateringSpinner;true);; 
ClearCollect(
 CollectLogg;
 Sort(
  Filter(
    'Logg';
    Status.Value = "Transfer to future date"
  );
  'Case Received';
  Descending
 )
);;
Collect(
 CollectLogg;
 Sort(
  Filter(
    'Logg';
    Status.Value <> "Transfer to future date"
  );
  'Case Received';
  Descending
 )
);;
Set(ManuellUppdateringSpinner;false)

 When I click the refresh button it shows me the older "Transfer to future dates" objects for a slight second and then it dissapears.

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,714)