cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gorilla_8
Impactful Individual
Impactful Individual

WHY THIS ERROR IS GETTING ON MY CODE??

Hey guys, I need to activate a filter with date +7 days on app start and disables when I filter by a date picker like this code:

 

 

SortByColumns(
   If( 
        drpFilter.Selected.Value = "Data início"&&var;
        Filter(
            collTaskListForGallery;
            DateValue(DatadeIníciodaTarefa) = DateAdd(Today();7;Days)
        );
        drpFilter.Selected.Value = "Data início"&&!var;
        DateValue(DatadeIníciodaTarefa) = DatePicker1.SelectedDate;
        collTaskListForGallery
    );
    "TrabalhoPercentualdaTarefaConcluído";
    If(
        radioporcentagem.Selected.Value = "Maior";
        Descending;
        radioporcentagem.Selected.Value = "Menor";
        Ascending
    );
    "OrdemdeManutenção";
    If(
        radiorodemOM.Selected.Value = "Maior";
        Descending;
        radiorodemOM.Selected.Value = "Menor";
        Ascending
    );
    "TrabalhoPercentualdaTarefaConcluído";
    If(
        toggle_porcentagem.Value = true;
        Ascending;
        toggle_porcentagem.Value = false;
        Descending
    )
)

 

 

Like this image:

 

filtererr0days.png

 

The error says:

The 'if' function has invalid arguments

 

Thanks for the help! I aprreciate it!

1 REPLY 1
Gorilla_8
Impactful Individual
Impactful Individual

I found the error, but the toggle is not working.

 

The code gonna be like this:

 

SortByColumns(
    If(
        drpFilter.Selected.Value = "Data início" && var;
        Filter(
            collTaskListForGallery;
            DateValue(DatadeIníciodaTarefa) = DateAdd(
                Today();
                7;
                Days
            );
            drpFilter.Selected.Value = "Data início" && !var;
            DateValue(DatadeIníciodaTarefa) = DatePicker1.SelectedDate
        );
        collTaskListForGallery
    );
    "TrabalhoPercentualdaTarefaConcluído";
    If(
        radioporcentagem.Selected.Value = "Maior";
        Descending;
        radioporcentagem.Selected.Value = "Menor";
        Ascending
    );
    "OrdemdeManutenção";
    If(
        radiorodemOM.Selected.Value = "Maior";
        Descending;
        radiorodemOM.Selected.Value = "Menor";
        Ascending
    );
    "TrabalhoPercentualdaTarefaConcluído";
    If(
        toggle_porcentagem.Value = true;
        Ascending;
        toggle_porcentagem.Value = false;
        Descending
    )
)

 

But why is the toggle is not working?

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

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