cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PwrApps
Frequent Visitor

If dropdown value = "This" then sort the data and filter, else sort in another way

Hi

 

It sounds complex but what I'm trying to do is the following:

 

If the Progress Tracker dropdown list = "Red",

- Sort the Sharepoint List

-- Filter(Select only items which are "Red" and also start with the letter chosen in the 'Filter' dropdown list)

Else

If the Progress Tracker dropdown list = "Amber" or "Green", 

- Sort the Sharepoint List

-- Filter(Select items which are Amber or Green)

Sort records by reference, ascending

 

My code is below:

 

If(
ddlRetrieveProgress_2.Selected.Title="Red",
Sort(
Filter(
ProjectRetrieval,
ProgressTracker = "Red" && StartsWith(Reference,ddlAtoZ_1.Selected.Value)
),
ddlRetrieveProgress_2.Selected.Title="Green",
Filter(
ProjectRetrieval,
ProgressTracker=ddlRetrieveProgress_2.Selected.Title
),
Reference,
Ascending
),
)

 

PwrApps_0-1623925944837.png

PwrApps_1-1623925975774.png

 

It doesn't seem to work and I get errors with 'Invalid number of arguments. Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions

If(
	ddlRetrieveProgress_2.Selected.Title="Red",
	SortByColumns(
		Filter(
			ProjectRetrieval,
			ProgressTracker = "Red" && StartsWith(Reference,ddlAtoZ_1.Selected.Value)
		),
		"Reference"),
		If(
			ddlRetrieveProgress_2.Selected.Title="Green",
		Filter(
			ProjectRetrieval,
			ProgressTracker=ddlRetrieveProgress_2.Selected.Title
				)
			)
)

Thanks I played with your ideas and came up with this. It now works!

View solution in original post

4 REPLIES 4
ganeshsanap
Super User
Super User

@PwrApps Try using below formula: 

 

If(
	ddlRetrieveProgress_2.Selected.Title = "Red",
	SortByColumns(
		Filter(
			ProjectRetrieval,
			ProgressTracker = "Red" && StartsWith(Reference, ddlAtoZ_1.Selected.Value)
		),
		Reference,
		Ascending
	),
	ddlRetrieveProgress_2.Selected.Title = "Green" || ddlRetrieveProgress_2.Selected.Title = "Amber",
	SortByColumns(
		Filter(
			ProjectRetrieval,
			ProgressTracker = ddlRetrieveProgress_2.Selected.Title
		),
		Reference,
		Ascending
	)
)

 


Please click Accept as solution & ‌‌👍 if my answer helped you to solve your issue. This will help others to find the correct solution easily. If the answer was useful in other ways, please consider giving it ‌‌👍

 

Best Regards,

Ganesh Sanap

Blog site 

Hi, 

 

Thanks. I've just tried this and it now says 'ShowColumns has some invalid arguments'.

PwrApps_0-1623928414654.png

 

If(
	ddlRetrieveProgress_2.Selected.Title="Red",
	SortByColumns(
		Filter(
			ProjectRetrieval,
			ProgressTracker = "Red" && StartsWith(Reference,ddlAtoZ_1.Selected.Value)
		),
		"Reference"),
		If(
			ddlRetrieveProgress_2.Selected.Title="Green",
		Filter(
			ProjectRetrieval,
			ProgressTracker=ddlRetrieveProgress_2.Selected.Title
				)
			)
)

Thanks I played with your ideas and came up with this. It now works!

View solution in original post

ganeshsanap
Super User
Super User

@PwrApps There is no ShowColumns function in my formula. Please check you are using wrong function name.


Please click Accept as solution & ‌‌👍 if my answer helped you to solve your issue. This will help others to find the correct solution easily. If the answer was useful in other ways, please consider giving it ‌‌👍

 

Best Regards,

Ganesh Sanap

Blog site 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,017)