cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Non-PrimaryKey in EditForm Drop Down

I have two tables as follows:

 

CUSTOMER (CustomerId (PK), CustomerName)

TICKET (TicketId (PK), Amount, CustomerId (FK ref CUSTOMER))

 

In an EditForm, I would like to add/edit a record to the TICKET table, and I would like the customers to be limited to what's in the CUSTOMER table. I've managed this by;

 

1. Make CustomerId in the EditForm a drop down.

2. Set Items property of it to Distinct(CUSTOMER, CustomerId)

 

This works fine, and I can add or edit a record in the TICKET table. But as you can see this is not very user friendly since you have to remember which customer each customer id refers to, so instead of doing this, I'd like to offer CustomerName as drop down content, but when the SUBMIT button is hit, I'd like the form to add/edit TICKET table by using appropriate CustomerID. How can I achieve this?

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi@Sachintha,

Based on the issue that you mentioned, do you want to submit the Ticket with a correct CustomerID?

Let me confirm something important with you, you edit/create the Ticket form using a Dropdown where you want to populate it with the CustomerName rather than CustomerID, however, you want to add a CustomerID to every record when you submit the Ticket form.

If my understanding is correct, I think the LookUp() function could achieve your needs.

I have a test on my side, please take a try as below:

Set the Items property of the Dropdown as below:

 

Distinct(CUSTOMER,CustomerName)

 

Set the Update property of the CustomerID Data Card as below:

 

LookUp(CUSTOMER,CustomerName=Dropdown1.Selected.Result,CustomerId)

 

 

0826003.png

Best Regards,

Qi

Best Regards,
Qi

View solution in original post

2 REPLIES 2
v-qiaqi-msft
Community Support
Community Support

Hi@Sachintha,

Based on the issue that you mentioned, do you want to submit the Ticket with a correct CustomerID?

Let me confirm something important with you, you edit/create the Ticket form using a Dropdown where you want to populate it with the CustomerName rather than CustomerID, however, you want to add a CustomerID to every record when you submit the Ticket form.

If my understanding is correct, I think the LookUp() function could achieve your needs.

I have a test on my side, please take a try as below:

Set the Items property of the Dropdown as below:

 

Distinct(CUSTOMER,CustomerName)

 

Set the Update property of the CustomerID Data Card as below:

 

LookUp(CUSTOMER,CustomerName=Dropdown1.Selected.Result,CustomerId)

 

 

0826003.png

Best Regards,

Qi

Best Regards,
Qi
Anonymous
Not applicable

Yes, that's exactly what I wanted, thanks!

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (2,252)