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

Copy Value from one screen's combo box to a different screen's combo box.

Hello.  I have a vehicle repair form that I’m building in Power Apps and Sharepoint list.

I have a field that has a combo box that selects a user which pulls from Active Directory. I have a sharepoint list that shows a list of vehicles to specific departments. So when a user types in their name, they only see their vehicles. All vehicles start with a single digit specific number.  This part works great.  But, I need to have  some users pick a different vehicle, not related to their department.  My thought is to have a button to open to another screen and they can select a different department vehicle.  Works fine as well. But, I need to be able to copy the selected value on screen 2 to screen 1 by pressing a submit button. I don't know how to do this since the combo box on Screen 1 already has code in it.   Attached is a word document with screenshots of layout and code. Hope this will describe better of what I’m trying to accomplish.  Any help will be appreciated.

 

Thank you! 

13 REPLIES 13
JR-BejeweledOne
Super User
Super User

Where are you wanting to display this value from screen 2, in the combobox on screen 1 or somewhere else?

 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Correct - The Value from Screen 2 to go to screen 1 DDVehicle_Number.  But the DDVehicle_Number card currently has the code, Filter('PW Vehicle List', Department = DDRequestor.Selected.Department) which I need to keep as well. Hope that make's sense. 

 

Thank you!

Tim 

JR-BejeweledOne
Super User
Super User

The users who need to be able to select a vehicle from a different department, can they select from any department or just certain departments?

 

 

 

 

 

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Any of them.  For convenience, the first screen just shows the vehicle that is in their own department. I have a button that takes them to screen 2 to list all of the vehicles. 

JR-BejeweledOne
Super User
Super User

Ok here is the simple way to do this and it eliminates extra navigation on the part of the user.

 

You don't indicate what determines if the user can select a vehicle from a different department, so I will give you two scenarios on how to handle that.

 

You will either need to use the Office365Users.MyProfileV2 to get the user and check the desired attribute to see if they are eligible to do this or you will need to create a separate data source list with all the users who should have this ability.

 

On app start set a variable, say, varAuthorization to false.   Then either using an attribute (job title, department, etc.) from the Office365Users.MyProfileV2:

 

Example: If( Office365Users.MyProfileV2.JobTitle = "xxxx", Set(varAuthorization, true) )

 

or comparing the logged in user to a list value:

 

Example (needs to match what you used in your list.  I prefer either email or display name whichever is unique):

Set(varUser, Office365Users.MyProfileV2().attribute)

If(varUser in list.columnname, Set(varAuthorization, true)

 

Once you have done that, there are a couple ways to do this.

 

1.  Have a hidden department dropdown the authorized user can use to filter the list of vehicles.    Set the visible property of this dropdown to varAuthorization.

 

   Then set your vehicle dropdown formula to this:   Substitute your correct values where needed.

 

  If(

      varAuthorization, Filter('PW Vehicle List', Department = DepartmentDropdown.Selected.Department),

      Filter('PW Vehicle List', Department = DDRequestor.Selected.Department)
)

 

 

2.   Allow the authorized user to see all the vehicles in the list.

 

   If(

        varAuthorization, 'PW Vehicle List',

        Filter('PW Vehicle List', Department = DDRequestor.Selected.Department)

)

 



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

Wow - I'm fairly new to this so will take some time to figure this out. Thank you and I will let you know if I'm able to handle this.  May not get to it until tomorrow. 

Thanks for the help! 

JR-BejeweledOne
Super User
Super User

I might be able to simplify it more if you tell me how your app will determine if a user can only see vehicles in their own department or all the vehicles.



If you like this post, give it a Thumbs up. If it answered your question, Mark it as a Solution to enable other users find it.

That would be awesome.  Are you able to view that word document that I have attached on my first message?  That shows screenshots that might help.  

Thanks again for your time.  This is the only thing that is holding me back from making my new Sharepoint intranet site go live.  

Ok - I have a sharepont list with a column of all of the vehicles and another column of Departments.  I have a card named DDRequestor that you can select by typing in an Active Directory name.  The Items code is Choices([@'City Vehicle Repair'].Requestor).   Once name is selected, the I have another combo box card named DDVehicle_Number which shows the vehicles in that user's department.  Code is  Filter ('PW Vehicle List', Department = DDRequestor.Selected.Department).    

 

Hope this helps. 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (31,814)