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

Return a single text value from a collection

I think I'm at the point where I've been staring at this for too long, and I'm missing something simple.

 

I have a collection that gathers an employee's record based on their unique ID. I'm trying to reach into that collection and return their Job Title as a variable to make certain functions only visible for those that need them. When I'm using a button with:

 

 

Set(Occupation, UserList.Job_Title);

 

 

I get an error everywhere the variable Occupation is used saying "Invalid argument type".  In the variables section, it says "Contribute types: Table" on the button.

 

In the App.Onstart, I'm using:

 

 

 

Set(Occupation, "Operator");

 

 

 

to designate everyone with the lowest privileges until their unique ID is put in. In the variables section, it says "Contribute types: Text".

 

So, I know I'm trying to compare a table to a text item. How do it return the text value from a specific column (Job_Title) in the collection (UserList) and assign it to my variable (Occupation)?

 

Any help is greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Rob_LVT ,

From the description, you have one record in this collection and you want one field from this record. Try this

Set(
   vOccupation,
   First(UserList).Job_Title
)

 

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.

View solution in original post

2 REPLIES 2
WarrenBelz
Super User
Super User

Hi @Rob_LVT ,

From the description, you have one record in this collection and you want one field from this record. Try this

Set(
   vOccupation,
   First(UserList).Job_Title
)

 

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.

View solution in original post

@WarrenBelz ,

 

That was what I was looking for! Thank you!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

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