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

Dropdowns and Data sources

I have an app that is connected to an Excel. So I created a data worksheet with all the columns. I need a dropdown in my app so I created a Table on a new tab(sheet) with the items I needed to have on the dropdown. 

 

I was able to create my dropdown in the app.

 

But ......


How do I connect the selected dropdown Item to my data work sheet when it is submitted?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Anonymous ,

The xxxx depends on the Items of your drop-down.

  • If it is Choices(YourListName.YourFieldName) - a Choice or Lookup field, then it is .Value
  • If a Distinct filter, then .Result
  • If based otherwise on a field, it is the actual field name.

If you type Dropdown2.Selected. (note second dot), you will see the valid values underneath.

There are also two options depending  on whether you are creating a new record or are wanting to edit the existing one

For existing (which is what I think you are asking), you have to refer to the "key" or unique matching field in the list that is also on your screen (you have to tell Power Apps which record to match). If the control running this code is inside (not on) a form or gallery you can simply use ThisItem (instead of the reference you need to find on the third line of the code). So assuming option 1

UpdateIf(
   QB_Invoice,
   MatchingFieldName=YourMatchingControlNameValue,
   {Item:Dropdown2.Selected.Value}
)

OR

UpdateIf(
   QB_Invoice,
   ThisItem,
   {Item:Dropdown2.Selected.Value}
)

 I assume your reference to Item is tot he field name to be updated.

For a new record

Patch(
   QB_Invoice,
   Defaults(QB_Invoice),
   {Item:Dropdown2.Selected.Value}
)

Happy to elaborate further.

 

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

6 REPLIES 6
KrishnaV
Super User
Super User

Hi @Anonymous ,

 

Follow the below steps:

  1. Take a blank screen
  2. Add dropdown control on the screen and provide the data from the newly created table on the sheet
  3. Use the edit form and select the DataSource as excel
  4. Item property of the form as 
    First(Filter(datasheetname.columns.value = dropdown.selected.value))
  5. Now add a button on the screen and onSelect property of the button add submitform(formname)

I hope this resolved your issue if you see any challenge let me know I am always happy to help.

Regards,

Krishna
If this post helps give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.
WarrenBelz
Super User
Super User

Hi @Anonymous ,

You can use Patch or UpdateIf to send the control selected items to the field.

UpdateIf(
   YourRecordKey Field = List KeyFieldName,
   {YourColumnName:YourDropDownName.Selected.xxxx}    //Value,Result/Field Name depending on Items
)

Happy to elaborate further.

 

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.

 

v-qiaqi-msft
Community Support
Community Support

Hi@Andreag,

Do you mean that you want to update the dropdown related records to your data worksheet?

From your description, I'm guessing you have 2 excel sheets. One for the data source, another for the sheet of selections connected to the dropdown control.

I assume that you want to save your dropdown selected items to your data worksheet when you submit. On this premise, I think the Patch function can achieve your needs. Please take a try as below:

Set the Items property of the Dropdown as below:

 

Distinct(Table2, ColumnA)

 

Set the OnSelect property of your Submit button as below:

 

Patch(
    DataSource,
    Defaults(DataSource),
    {ColumnName: Dropdown4.Selected.Value}
)​

 

NoteDataSource is your data worksheet.

Best Regards,

Qi

Best Regards,
Qi
Anonymous
Not applicable

@WarrenBelz 

Thank you very much!

Im very much new at this can you please explain what the xxxx would be? My dropdown is a list of Services we provide (no numbers or values) so would the xxxx be .text? or something else? 

 

Also the section Field name depending on Items ... is that where I would list my dropdown items? not 100% sure what that would be.

here is what I have... am I close? 
UpdateIf(QB_Invoice,Item,{Item:Dropdown2.Selected.xxxx}//Value,Results/Field Name depending on Items )

 

QB_Invoice is the main data source that I need the dropdown data to go to 

QB_Invoice column that I need the info to go to is called Item

Table2 (which is the Dropdown excel table)

Table2 dropdown header is called Items

Dropdown name is Dropdown2 

Hi @Anonymous ,

The xxxx depends on the Items of your drop-down.

  • If it is Choices(YourListName.YourFieldName) - a Choice or Lookup field, then it is .Value
  • If a Distinct filter, then .Result
  • If based otherwise on a field, it is the actual field name.

If you type Dropdown2.Selected. (note second dot), you will see the valid values underneath.

There are also two options depending  on whether you are creating a new record or are wanting to edit the existing one

For existing (which is what I think you are asking), you have to refer to the "key" or unique matching field in the list that is also on your screen (you have to tell Power Apps which record to match). If the control running this code is inside (not on) a form or gallery you can simply use ThisItem (instead of the reference you need to find on the third line of the code). So assuming option 1

UpdateIf(
   QB_Invoice,
   MatchingFieldName=YourMatchingControlNameValue,
   {Item:Dropdown2.Selected.Value}
)

OR

UpdateIf(
   QB_Invoice,
   ThisItem,
   {Item:Dropdown2.Selected.Value}
)

 I assume your reference to Item is tot he field name to be updated.

For a new record

Patch(
   QB_Invoice,
   Defaults(QB_Invoice),
   {Item:Dropdown2.Selected.Value}
)

Happy to elaborate further.

 

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.

Hi @Anonymous 

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

 

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.

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (3,051)