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

No Data Returned from Choices() function

Hi

 

I'm trying to use "Choices()" to populate a drop-down, and have also tried using a data table with no success.

 

I'm trying to pull the options/data from a "People" field "User" in a Sharepoint List 'Marketing Job Assignees'

 

Choices('Marketing Job Assignees'.User)

 

As I am typing into the function bar, it looks like I will get a result...

choices1.png 

 

But then as close my bracket, it all of a Sudden cant find anything...

choices2.png

 

Not sure what I am missing here?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Sandie ,

Ok. I'm glad that you've solve the problem about patching.

I just thought you only want know the part of displaying, not including patching, so I just answered you the display part.

About you current question:

Could you tell me

1)the relationship of User field and 'Email Assigned To' field?

2)the data type of 'Email Assigned To' field?

You asked about how to display and patch User column, why you set this drop down's Default about 'Email Assigned To' field?

 

If you still want to display specific record's User column, you should set the drop down's Default to :

ThisItem.User.DisplayName

 

Best regards,

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

11 REPLIES 11
Super User
Super User

@Sandie 

I don't think Choices() works with People Picker / Person columns, pretty sure it only works for LookUp and Choice columns. You could try using the Office365 connector to get what you need?

 

Try this on the Dropdown Items property:

Office365Users.SearchUsers().DisplayName

But that will return every user in my organisation right?  I only want it to be people in this other SharePoint list (about 4 people currently, my entire company is ~60,0000 people), and I don't want to have to go in and change hard-coded information every time we add or remove someone. 

Super User
Super User

@Sandie 

Ok, I get what you are trying to do now, try this

// clear the collect first
Clear(colPickedPeople);

// collect into colPickedPeople a table of names
ForAll(ShowColumns(
    'Marketing Job Assignees',"User"),
    ForAll(User,
    Collect(colPickedPeople, {PersonName: DisplayName})));

// create a Distinct list of picked People
ClearCollect(colPicked, RenameColumns(Distinct(colPickedPeople,PersonName),"Result", "People"))

Note: this won't show a Delegation issue but this code will only work on a data set <2000 records in size. This doesn't relate to your >60,000 employees but rather the SP List size, if that makes sense.

 

Let me know how you get on.

 

 

Community Support
Community Support

Hi @Sandie ,

Actually, Choices function could work for these data type: lookup, choice and person.

Person data type is a special lookup type.

However, lookup field and choice field has its limited value.

Choices for person field are all the accounts in your talent, which may be very large.

So usually, we use Choices(listname.personfieldname) in combo box's Items property.

 

In your issue, I think you do not want all the accounts in your talent. Do you only want 4 person choices in the drop down list?

Could you tell me where does these 4 person choices come from? this list's existing person value or from other list,ect?

I assume that they are this list's existing person value.

If so,try this to set the drop down's Items:

Distinct('Marketing Job Assignees',User.Email)

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

RE: 

// clear the collect first
Clear(colPickedPeople);

// collect into colPickedPeople a table of names
ForAll(ShowColumns(
    'Marketing Job Assignees',"User"),
    ForAll(User,
    Collect(colPickedPeople, {PersonName: DisplayName})));

// create a Distinct list of picked People
ClearCollect(colPicked, RenameColumns(Distinct(colPickedPeople,PersonName),"Result", "People"))

 

Sorry, my PowerApps skills are very patchy... not sure where this goes? In the "Items" field of my drop down?


@v-yutliu-msft wrote:

 

If so,try this to set the drop down's Items:

 

Distinct('Marketing Job Assignees',User.Email)

 

 


This just gives me a list with Email Addresses, not names.

 


@v-yutliu-msft wrote:

Could you tell me where does these 4 person choices come from? this list's existing person value or from other list,ect?

I assume that they are this list's existing person value.

 


As above, my four names are in a Sharepoint List 'Marketing Job Assignees' which has a "People" field called "User".  They are people in my organisation

 


@v-yutliu-msft wrote:

Choices for person field are all the accounts in your talent, which may be very large.

So usually, we use Choices(listname.personfieldname) in combo box's Items property.


Yes, I tried 

Choices('Marketing Job Assignees'.User)

But it does not work for me

 

@Sandie 

I'd recommend you put this code in the OnVisible of your screen. You could also add it to a button (just to see if it works?) or in the App OnStart as well. Th choice is yours.

 

You then use the collection created - colPicked - as the Items of your Dropdown.

Hi @Sandie ,

If you just want names instead of emails, you just need to make a little change.

set the drop down's Items:

Distinct('Marketing Job Assignees',User.DisplayName)

 

 

Best regards, 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.


@v-yutliu-msft wrote:

Hi @Sandie ,

If you just want names instead of emails, you just need to make a little change.

set the drop down's Items:

 

Distinct('Marketing Job Assignees',User.DisplayName)

 

 

 

Best regards, 


It doesn't save any data to the field.  The field is a "People" field, not a "Text" field

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

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

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (21,283)