cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
slhangen
Helper V
Helper V

Easy Syntax question

Getting an error with following syntax but can't figure out where my error is.  Any help would be much appreciated.

 

SortByColumns

          (If

                (ddLevelSelector.SelectedText.Value= "All Levels", Interventions,
                Filter(Interventions, ddLevelSelector.SelectedText.Value=ConcernLevel,
"ReferralDate", Descending, "LastName", Ascending, "LastName", Ascending
)
)

1 ACCEPTED SOLUTION

Accepted Solutions
v-albai-msft
Microsoft
Microsoft

Hi @slhangen ,

Do you want to display “Interventions” when ddLevelSelector.SelectedText.Value= "All Levels" , otherwise display the results of Filter(Interventions, ddLevelSelector.SelectedText.Value=ConcernLevel) ?

If yes, maybe you place the “)” in a wrong location.

Also, if ConcernLevel is one of the choices from ddLevelSelector, you should use ddLevelSelector.SelectedText.Value=”ConcernLevel” in Filter() as a condition.

You can try below formula:

SortByColumns
          (If
                (ddLevelSelector.SelectedText.Value= "All Levels", Interventions,

                Filter(Interventions, ddLevelSelector.SelectedText.Value=”ConcernLevel”))  

"ReferralDate", Descending, "LastName", Ascending, "LastName", Ascending
)

Best Regards,

Allen

View solution in original post

4 REPLIES 4
RandyHayes
Super User III
Super User III

@slhangen 

Please consider changing your Formula to the following:

SortByColumns
    Filter(Interventions, 
        (ddLevelSelector.SelectedText.Value= "All Levels" || ddLevelSelector.SelectedText.Value=ConcernLevel)
    ),
    "ReferralDate", Descending, 
    "LastName", Ascending, 
    "LastName", Ascending
)

Also, you should replace the SelectedText properties in your formula as it is a deprecated property.

 

I hope this is helpful for you. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
v-albai-msft
Microsoft
Microsoft

Hi @slhangen ,

Do you want to display “Interventions” when ddLevelSelector.SelectedText.Value= "All Levels" , otherwise display the results of Filter(Interventions, ddLevelSelector.SelectedText.Value=ConcernLevel) ?

If yes, maybe you place the “)” in a wrong location.

Also, if ConcernLevel is one of the choices from ddLevelSelector, you should use ddLevelSelector.SelectedText.Value=”ConcernLevel” in Filter() as a condition.

You can try below formula:

SortByColumns
          (If
                (ddLevelSelector.SelectedText.Value= "All Levels", Interventions,

                Filter(Interventions, ddLevelSelector.SelectedText.Value=”ConcernLevel”))  

"ReferralDate", Descending, "LastName", Ascending, "LastName", Ascending
)

Best Regards,

Allen

View solution in original post

Works perfectly!  Been fighting this for weeks.

 

Thanks again!!!

RandyHayes
Super User III
Super User III

@slhangen 

In general, it is not good practice to put If statements to select two (or more) datasources.  In your case you are taking the suggestion of @v-albai-msft which uses this method.  

Take a look at the formula I provided as it avoids this bad practice.

 

And..for your weeks of fighting...hit up the forums as soon as you start to struggle.  Plenty of minds here that will get you on the right course and save you some time. 😁

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (39,568)