cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dahlgebra
Helper II
Helper II

Combine "Choices" and User().FullName

Name 1Name 2Name 3
FootballTable TennisBasket 
TennisHockeyFootball

Table name: "sharepointlist"

 

I have a combo box with this code under "Items" : Choices(sharepointlist.'Name 2'). Is is connected to the SP-list above.  When I press the button it shows me the desired alternatives: "Table Tennis" and Hockey. So far so good. 

 

Now I want to make the app more useful by replacing Name 2 with User().FullName. So if the user's name is "Name 1" it shows the alternatives "Football" and "Tennis", if the user's name is "Name 2" it shows "Table Tennis" and "Hockey" and so on....

 

How can I achieve this? I have already made a variable that is created OnStart: "Set(vFullName; (User().FullName))".

I tried to replace Choices(sharepointlist.'Name 2') with Choices(sharepointlist.vFullName) but that didn't work 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

Hi @dahlgebra 

 

Variable cannot be recognized as the column, so the code ( Choices(sharepointlist.vFullName) ) is a dead end.

If you want to display the combo box option dynamically based on the user name, please try this.

 

Switch(User().FullName,"Name 1",Choices(sharepointlist.'Name 1'), "Name 2",Choices(sharepointlist.'Name 2'), "Name 3",Choices(sharepointlist.'Name 3'))

 

Hope this helps.

Sik

Please click "Accept as Solution" if my post answered your question

View solution in original post

5 REPLIES 5
WarrenBelz
Super User
Super User

Hi @dahlgebra ,

You have made a good start with the variable vUser for User().FullName - this gets rid of delegation issues.

I assume you want to filter a gallery as per your screenshot to show only the items in Name 1 and Name 3 belonging to the User whose name is in Name 2 in your list SharePointList ?

The Items property of the gallery would be.

Filter(
   SharePointList,
   'Name 2' = vUser
)

 

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.

The alternatives that show up are dependent upon the user's name. The column settings in the SharePoint list is of type (Choice). So I have already predefined what alternatives that should appear for different users of the app. Let us say that i have defined the options that should appear when you log in to the app. I have then already made a column for you in the SP-list with defined choices. So when you press the combo box, only those alternatives should be visible. This can be achieved by writing: Choices(sharepointlist.WarrenBelz). But I have to write it dynamically so it would work for other users as well. Right? If not, everyone that uses the app will see the alternatives that is defined for you. 

 

Thanks

Hi @dahlgebra ,

You can hide column 2 or not even display it in the gallery.

It is still part of the data set, so can be referenced in the 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.

 

v-siky-msft
Community Support
Community Support

Hi @dahlgebra 

 

Variable cannot be recognized as the column, so the code ( Choices(sharepointlist.vFullName) ) is a dead end.

If you want to display the combo box option dynamically based on the user name, please try this.

 

Switch(User().FullName,"Name 1",Choices(sharepointlist.'Name 1'), "Name 2",Choices(sharepointlist.'Name 2'), "Name 3",Choices(sharepointlist.'Name 3'))

 

Hope this helps.

Sik

Please click "Accept as Solution" if my post answered your question

View solution in original post

Hi @dahlgebra ,

@v-siky-msft has provided a solution to a scenario I did not think was the case. If this is correct, please accept it.

My reading of your requirements were you were going to put the user name in column 2 and needed to display column 1 and 3.

 

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,043)