cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tfarsund
Level: Powered On

Combobox showing items from one column, updating database with another column

Hi everyone,

Just want to check that my solution, that works right now, is correct (i.e that it is not just a coincidence that it works now).

I have two tables in my database:
- one describing types of employee contracts and the code to the specific employee contract (i.e, two columns: "ansettelsestype" and "ansettelsestypeKode")
- one with information for the employee, where one column contains their employee contract

In my app I have an edit form where one input is a combobox where the user should pick the type of employee contract.
I want the combobox to have items equal to the "ansettelsestype" column, but I want the updated value in the database to be the code, i.e "ansettelsestypeKode".

In the OnVisible property of the infopage I collect the table with employee contracts:
- ClearCollect(colDDAnsettelsestype;'[dbo].[DDAnsettelsestype]');
This collection has two columns, the first one being "ansettelsestype" and the second "ansettelsestypeKode"

In the Item property of the combobox I have:
- colDDAnsettelsestype

In the Update property of the datacard I have:
- DataCardValue45.Selected.AnsettelsestypeKode

As I wish, the items showing in the combobox are the first column in the collection, the "ansettelsestype" column, and when the user chooses an item and saves, the database column is updated with the code, the "ansettelsestypeKode" column. 

What makes me doubt the solution is that the Item property does not specify the first column of the collection. It basically says "use the whole collection as items". Does it choose the first column by default? If this is the case and it will always choose this column, Im happy.

I would apprectiate some comments/confirmation here,

Thanks!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Combobox showing items from one column, updating database with another column

Hi,

 

Yes, I think it chooses the first column of your collection, however it is the whole collection in the dropdown (which is how you're able to then update using it's Kode value).

 

Cheers,

ManCat




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

1 REPLY 1
Super User
Super User

Re: Combobox showing items from one column, updating database with another column

Hi,

 

Yes, I think it chooses the first column of your collection, however it is the whole collection in the dropdown (which is how you're able to then update using it's Kode value).

 

Cheers,

ManCat




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (4,442)