cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Super User
Super User

Re: Return a single text value from a collection

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
Highlighted
Super User
Super User

Re: Return a single text value from a collection

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

Highlighted
Frequent Visitor

Re: Return a single text value from a collection

@WarrenBelz ,

 

That was what I was looking for! Thank you!

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (4,478)