web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Change data source for...
Power Apps
Answered

Change data source for a drop down on the basis of label text

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

 

I have a drop down which consists the list of sub ordinates and I want to change its value on the basis of manager who logs in

 

So I have written a code for a "Drop Down" in its item field to change the source data (table) depending on the value of "Label1" which returns the name of the person who logs in

 

If(Label1.Text="Tom Stuart",Table1,Table3)

 

(i.e if Tom Stuart logs in then drop down should display list as per Table 1 else Table 3, I also want to convert this code into multiple if statement as there is a big list of managers and their subordinates)

 

But the above code gives me an error with a info sign that "columns produced by this rule are nested tables/records, however property expects atleast some simple values (such as text or numbers)"

 

Please assist with a correct code to resolve this error.

 

One more ques? let me know if there is a code to get subordinates list from outlook.

Categories:
I have the same question (0)
  • Verified answer
    v-micsh-msft Profile Picture
    Microsoft Employee on at

    If you would like to switch Data Source for the Dropdown Control, the available way is to use Lookup() function.

    First we need to save the Table within a collection.

    Add a Button, enter the following code for the TableCollection under the OnSelect property, or you may put it under the Screen OnVisible property:

    ClearCollect(TableCollection, 
    Table({UserName:"UserFullName1",Table:Table1},
    {UserName:"UserFullName2",Table:Table3})
    )
    ClearCollect(Userstring,User())

    For User logs in, the formula for the items property of the Dropdown should be:

    Lookup(TableCollection, UserName=First(Userstring).FullName, Table)

    To get the Manager of current user, we could take use of Office 365 Users connection.

    Also you could take use of the Office365Users.DirectReports() to get the direct reports for the specified user.

    More information, see the documentation:

    Connect to Office 365 Users connection from PowerApps

     

    Regards,

    Michael

  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @Anonymous,

     

    Do you need any further help on this?

     

    Regards,

    Michael

  • clau0289 Profile Picture
    76 on at

    Hello Michael,

     

    I was looking for something like this but I have found a couple of barriers I cannot jump...

    What If you had to chage some data in the TableCollection that should be also reported in its corrispondant Table1 or Table2... etc?

    How would you manage attachments?

     

    I am facing this problem not with simple tables but with sharepoint lists with attachments and I can't get around this to find a solution. Any ideas?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard