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
VijayTailor
Resident Rockstar
Resident Rockstar

Hi @Anonymous ,

You can use Like below.

First Ways.
Filter(
        Sort(
            Logg;
            'Case received';
            Descending
        ),Status="Transfer to future date");

 

Thanks,
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Anonymous
Not applicable

@VijayTailor Sorry, this wont work for me. I dont think this is what i'm searching for.

 

I want the status: "Trasfer to future date" to always be visible in my gallery and also be able to sort on "Case received".

 

Maybe its a problem when i'm trying to implement this on my full code?

 

If(
    'Toggle'.Value;

    Filter(
        Sort(
            Logg;
            'Case received';
            Descending
        );
        TextInput1.Text in 'Case number'; 
        
        Avtalsområde.Value = "EAST" ||
Avtalsområde.Value = "WEST";
        Status.Value in "Ongoing
    );
        Filter(
        Sort(
            Logg;
            'Case received';
            Descending);   
   TextInput1.Text in 'Case number'; 
   Avtalsområde.Value in ComboBox2.SelectedItems.Value; Status.Value in 'Sort on status'.SelectedItems.Value &&
   
   If(Status.Value in "Finished"; 'Created'>=Today();true)
   
   ||
   
   If(Status.Value in "Finished" && ToggleOldData.Value=false; 'created'>=Today();true)))

Hi @Anonymous 
For this Requirment - 

YOu can set the ComboBox DefaultSelectedItem Property is Like that way ["Trasfer to future date""].
And use the   Condition  Like below.

YOu can Try Like Below.
if (IsBlank(TextInput1.Text) || IsEmpty(TextInput1.Text),
Filter(
        Sort(
            Logg;
            'Case received';
            Descending);   
   TextInput1.Text in 'Case number'; 
   Avtalsområde.Value in ComboBox2.SelectedItems.Value; Status.Value in 'Sort on status'.SelectedItems.Value && Created=Today(),Filter(
        Sort(
            Logg;
            'Case received';
            Descending
        );
        TextInput1.Text in 'Case number'; 
        
        Avtalsområde.Value = "EAST" ||
Avtalsområde.Value = "WEST";
        Status.Value in "Ongoing
    );)


Thanks,
 

Anonymous
Not applicable

@VijayTailor Hello again, sorry for late replay

 

I dont really understand your code, it doesnt work for me when i'm trying it. Some things seems to be missing.

 

I dont think you really understand what i'm trying to accomplish, I will try to explain further.

 

This is a Servicedesk support app i'm creating. There will be about 100 objects each day thats created.

 

The problem is:

Some cases have an status "Transfer to future date" that can be a week from now and by that time the app will have 700 cases and that older case "Transfer to future date" will be gone. Is there anyway to make that status be sorted on firsthand?

 

Something like this?:

        Sort(
            Logg;
            Status.Value="Transfer to future date";
            Descending;
            'Case received';
            Descending);   

 

Hi @Anonymous,

As per below Post your issue is Like.

You can to filter the records having the status "Transfer to future date" and Suppose expire date is yesterday.
So you open App today you want to see all the Record having the above status and future date is passed/Expired.
See the Approach to archive the expected Outcome.

AddColumns(Filter(TestAkshay,Complexity.Value="Transfer to future date"),"DaysExpired",If(DateDiff(DateField,Today())>=1,"Expired","NE"))

VijayTailor_0-1602232489544.png

Thanks,



Hi @Anonymous :

Do you want to rank the records whose'status' value is "Trasfer to future date" based on the original formula?

If so,just nest another Sort outside.Please try this code:

Sort(
   If(
       'Toggle'.Value;
       Filter(
           Sort(
               Logg;
               'Case received';
               Descending
           );
           TextInput1.Text in 'Case number';
           Avtalsområde.Value = "EAST" ||Avtalsområde.Value = "WEST";
           Status.Value in "Ongoing
       );
       Filter(
           Sort(
               Logg;
               'Case received';
               Descending
           );  
           TextInput1.Text in 'Case number';
           Avtalsområde.Value in ComboBox2.SelectedItems.Value;
           Status.Value in 'Sort on status'.SelectedItems.Value && If(Status.Value in "Finished"; 'Created'>=Today();true) || If(Status.Value in "Finished" && ToggleOldData.Value=false; 'created'>=Today();true)
       )
   );
   If(status="Trasfer to future date";1;0);
   Descending
)

Best Regards,

Bof

 

Anonymous
Not applicable

@v-bofeng-msft Hello! Yes, thats exacly what I want. But I recently started using ClearCollect instead and this doesnt work with ClearCollect. My formula for ClearCollect looks like this today:

 

Set(ManuellUppdateringSpinner;true);; ClearCollect(CollectLogg;Sort('Logg';'Case Receivec';Descending));;Set(ManuellUppdateringSpinner;false)

 

Can I make the Clearcollect first get all the statuses "Transfer to future date" and then sort on "Case received" ? Something like this? (Doesnt work but i tried):

Set(ManuellUppdateringSpinner;true);; ClearCollect(CollectLogg;Sort(Sort('Logg';If(Status.Value = "Transfer to future date";1;0);Descending);'Case Received';Descending
);;Set(ManuellUppdateringSpinner;false))

 

Hi @Anonymous :

Could you tell me:

  • What is your date source?Share Point?CDS?
  • Does "not work" means that all records cannot be obtained or there are any error (red warning) occurs?
  • What property of the control did you put this code in?

I tested this method should be feasible.

Considering that your data source may have more than 500 or more than 2000 records, and this formula has is not delegable. I suggest you sort ‘Case Received’ first, and then sort ‘Status.Value’ (this can reduce the impact of not being able to delegate).For example:

Set(ManuellUppdateringSpinner;true);; 
ClearCollect(
   CollectLogg;
   Sort(
     Sort(
      'Logg';
       'Case Received';
       Descending
     );
   If(Status.Value = "Transfer to future date";1;0);
   Descending);;
Set(ManuellUppdateringSpinner;false))

Best Regards,

Bof

 

Anonymous
Not applicable

@v-bofeng-msft 

 

My source is a Sharepoint list

 

With "not work" i mean by the records with the column "Transfer to future date" doesnt seem to be fetched. No red error warnings.

 

Its on the property OnSelect in an icon

 

I tested your provided code but still doesnt seem to fetch the status "transfer to future date" 😞

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,649)