Halllo All,
I have built a gallery where all created requests are displayed. This sorts by itself somehow. But now, I want, that the latest requests are always displayed at the top, how can I achieve that? What do I have to change in the current code?
(See picture below)
If(varSortbyStatus;
SortByColumns(
Filter(
AddColumns(
colUrlaubReise; "StatusText";Status.Value
);
Erstelltvon.Email = User().Email);
"StatusText"; ["Beantragt"; "Genehmigt";"Abgelehnt";"Storniert"]);
Filter(colUrlaubReise;
If(varFilter = "Alle"; true; Status.Value=varFilter);
Erstelltvon.Email = User().Email)
)
Thanks in advance!
Hi @PowerSäm ,
Please give the below a go. Unfortunately I don't have time to test it.
SortByColumns(
Filter(
AddColumns(
colUrlaubReise; "StatusText";Status.Value
);
Erstelltvon.Email = User().Email);
If(varSortbyStatus; "StatusText"; ["Beantragt"; "Genehmigt";"Abgelehnt";"Storniert"]);
Erstelldatum; Descending
)
Ps. I hope I got the translation for the 'Created' column in Sharepoint correct: Erstelldatum
Hello @BCBuizer ,
thank you for your quick reply.
Do you mean like this? Unfortunately it shows me an error in the IF statement. What can be the reason for this?
I had to change the order, first descending then the Erstelldatum ("Erstelltam").
Do you have any idea?
Thank you
Hi @PowerSäm,
I was trying something to combine the two filters, but that doesn't seem to work. You'll probably have better luck with the below where both filters are completely separated and where the Erstelltam column has been added:
If(varSortbyStatus;
SortByColumns(
Filter(
AddColumns(
colUrlaubReise;
"StatusText";
Status.Value
);
Erstelltvon.Email = User().Email
);
"StatusText"; ["Beantragt"; "Genehmigt";"Abgelehnt";"Storniert"];
"Erstelltam"; Descending
);
SortByColumns(
Filter(
colUrlaubReise;
Erstelltvon.Email = User().Email
);
"Erstelltam"; Descending
)
)
Thank you for your reply, @BCBuizer
.
Unfortunately, it told me that the SortbyColumn function has invalid arguments (see image below).
Why? What can be the reason for that?
Thank you very much in advance.
Hi @PowerSäm ,
Not sure what is happening here is the sorting order for StatusText is copied lierally from your opening post where it doesn't produce any errors. Have any changes been made to the Status Column?
Hello and thank you so much for your reply, @BCBuizer .
I think the problem is that we forgot the ELSE function. In the original code is the following formula (see pic below).
But now this has been forgotten. Can it be because of this?
Thank you very much in advance!
Hi @PowerSäm,
There is an Else statement in there, but I see it is missing a line. Unfortunately this is not the part that is causing the error:
For completeness, here's the code with the missing line included:
If(varSortbyStatus;
SortByColumns(
Filter(
AddColumns(
colUrlaubReise;
"StatusText";
Status.Value
);
Erstelltvon.Email = User().Email
);
"StatusText"; ["Beantragt"; "Genehmigt";"Abgelehnt";"Storniert"];
"Erstelltam"; Descending
);
SortByColumns(
Filter(
colUrlaubReise;
If(varFilter = "Alle"; true; Status.Value=varFilter);
Erstelltvon.Email = User().Email
);
"Erstelltam"; Descending
)
)
For testing purposes, can you try replacing the sort order for the StatusText to Descending to see if that makes the error go away?:
If(varSortbyStatus;
SortByColumns(
Filter(
AddColumns(
colUrlaubReise;
"StatusText";
Status.Value
);
Erstelltvon.Email = User().Email
);
"StatusText"; Descending;
"Erstelltam"; Descending
);
SortByColumns(
Filter(
colUrlaubReise;
If(varFilter = "Alle"; true; Status.Value=varFilter);
Erstelltvon.Email = User().Email
);
"Erstelltam"; Descending
)
)
Hi @BCBuizer and thank you sooo much for your reply!
Sorry for the late reply, but lately I had not managed to be active here on the community page, so I saw your answer only now.
Thank you, your second solution worked great, just as I was looking for!
But now I have only another small problem, which worked before...
If I click on the button "Kategorie", then all requests should be attracted, but by application type, means first of all all leave applications and then all business trip applications (See image below).
I have already stored in a column in Sharepoint after each request what type it is. (See image below)
How can I build now the button so that it first shows all requests with "request type = "leave""(In german "Urlaub") and then "request type= "business trip""(In german "Dienstreise")?
The button now is just built up as follows (See image below).
Regarding the gallery, you already know how this one is build.
Thank you so much! You are a great help. Thank you very much!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
User | Count |
---|---|
189 | |
95 | |
65 | |
64 | |
58 |
User | Count |
---|---|
243 | |
163 | |
94 | |
82 | |
80 |