Hi, I wanna sort by the newest item to the oldest on this formula with multiple filters...
If(
varUser.Email = "erica.dias@arapyauinstituto.onmicrosoft.com";
Sort(Filter(
Despesas;
Solicitante = TextInput1.Text || 'Status de pagamento'.Value = DropDown1_2.Selected.Value || ID = DropDown1_1.Selected.ID
);Descending);
Sort(Filter(
Despesas;
'Status de pagamento'.Value = DropDown1_2.Selected.Value || ID = DropDown1_1.Selected.ID;
CreatorEmail = varUser.Email
);Descending
)
And I got a delegation warning...
Solved! Go to Solution.
Hi @Gorilla_8 ,
Based on the formula that you mentioned, I think you have some misunderstanding with the Sort formula. The second argument of the Sort function is required to provide a formula which would be calculated into a single one value, but the Filter formula you provided returned is a Table value.
Normally, the second argument of the Sort function is used to reference a column from your data source as Sort column. So please modify your formula as below:
If(
varUser.Email = "erica.dias@arapyauinstituto.onmicrosoft.com";
Sort(
Filter(
Despesas;
Solicitante = TextInput1.Text || 'Status de pagamento'.Value = DropDown1_2.Selected.Value || ID = DropDown1_1.Selected.ID
);
Created; // Reference column name from your Despesas data source here
Descending
);
Sort(
Filter(
Despesas;
'Status de pagamento'.Value = DropDown1_2.Selected.Value || ID = DropDown1_1.Selected.ID;
CreatorEmail = varUser.Email
);
Created; // Reference column name from your Despesas data source here
Descending
)
)
Note: The second argument of the Sort function is required to provide a formula which would be calculated into a single value rather than table value.
For your first formula you mentioned, you have missed the second argument in your Sort function. For your second formula, you have some misunderstanding on which value should be typed as the second argument in the Sort function. Hope above explanation could help in your scenario.
Please check the sample of Sort function in the following article for more details:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-sort#examples
Best regards,
To answer the question you have asked, apart from missing a closing bracket on what you posted, Choice or Lookup columns are not Delegable.
'Status de pagamento'.Value
If(
varUser.Email = "erica.dias@arapyauinstituto.onmicrosoft.com";
Sort(
Filter(
Despesas;
Solicitante = TextInput1.Text ||
'Status de pagamento'.Value = DropDown1_2.Selected.Value ||
ID = DropDown1_1.Selected.ID
);
ID,
Descending
);
Sort(
Filter(
Despesas;
'Status de pagamento'.Value = DropDown1_2.Selected.Value ||
ID = DropDown1_1.Selected.ID;
CreatorEmail = varUser.Email
);
ID;
);Descending
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hi @WarrenBelz !
thanks for the reply, so how I can sort this gallery or I cant do it?
You can sort it as posted by ID to get the newest records on top - it is the Filter that is the issue (so it will only give you the first 2000 records to filter)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Hi @Gorilla_8 ,
Could you please share a bit more about the Delegation issue in your formula?
Based on the Sort formula that you mentioned above, I think there is something wrong with it. The syntax formula of the Sort function as below:
Sort( Table, Formula [, SortOrder ] )
within your Sort formula, you have missed the second argument -- which column you want to sort by.
Please modify your formula as below:
If(
varUser.Email = "erica.dias@arapyauinstituto.onmicrosoft.com";
Sort(
Filter(
Despesas;
Solicitante = TextInput1.Text || 'Status de pagamento'.Value = DropDown1_2.Selected.Value || ID = DropDown1_1.Selected.ID
);
Created; // Type the Created column here
Descending
);
Sort(
Filter(
Despesas;
'Status de pagamento'.Value = DropDown1_2.Selected.Value || ID = DropDown1_1.Selected.ID;
CreatorEmail = varUser.Email
);
Created; // Type the Created column here
Descending
)
)
Please consider take a try with above solution, them check if the issue is solved.
Best regards,
Hi @WarrenBelz and @v-xida-msft ! Thanks for the reply!
@WarrenBelz Thanks for the help again!
So, @v-xida-msft , I know the formula about the "sort" is Sort( Table; Formula [; SortOrder ])
But If I try put this code:
If(
varUser.Email = "admin@user.com";
Sort(Filter(
Despesas;
Solicitante = TextInput1.Text || 'Status de pagamento'.Value = DropDown1_2.Selected.Value || ID = DropDown1_1.Selected.ID
);Ascending);
I got a delegation warning, like the @WarrenBelz told me about it!
And If I try with a formula:
If(
varUser.Email = "user@admin.com";
Sort(
Despesas;
Filter(
Despesas;
Solicitante = TextInput1.Text || 'Status de pagamento'.Value = DropDown1_2.Selected.Value || ID = DropDown1_1.Selected.ID
);
Ascending
);
Sort(Despesas;
Filter(
Despesas;
'Status de pagamento'.Value = DropDown1_2.Selected.Value || ID = DropDown1_1.Selected.ID;
CreatorEmail = varUser.Email
);Ascending)
)
I don't understand why got an error
Hi @Gorilla_8 ,
Based on the formula that you mentioned, I think you have some misunderstanding with the Sort formula. The second argument of the Sort function is required to provide a formula which would be calculated into a single one value, but the Filter formula you provided returned is a Table value.
Normally, the second argument of the Sort function is used to reference a column from your data source as Sort column. So please modify your formula as below:
If(
varUser.Email = "erica.dias@arapyauinstituto.onmicrosoft.com";
Sort(
Filter(
Despesas;
Solicitante = TextInput1.Text || 'Status de pagamento'.Value = DropDown1_2.Selected.Value || ID = DropDown1_1.Selected.ID
);
Created; // Reference column name from your Despesas data source here
Descending
);
Sort(
Filter(
Despesas;
'Status de pagamento'.Value = DropDown1_2.Selected.Value || ID = DropDown1_1.Selected.ID;
CreatorEmail = varUser.Email
);
Created; // Reference column name from your Despesas data source here
Descending
)
)
Note: The second argument of the Sort function is required to provide a formula which would be calculated into a single value rather than table value.
For your first formula you mentioned, you have missed the second argument in your Sort function. For your second formula, you have some misunderstanding on which value should be typed as the second argument in the Sort function. Hope above explanation could help in your scenario.
Please check the sample of Sort function in the following article for more details:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-sort#examples
Best regards,
User | Count |
---|---|
175 | |
111 | |
86 | |
44 | |
42 |
User | Count |
---|---|
229 | |
118 | |
116 | |
74 | |
67 |