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

Help populating text box based on value of drop down

Hello, 

I have a combobox in which I am loading values from the database, which means that the datasource for the combo box is a table, in the property, On its display field I have selected one field from the table which is displaying in combo box dropdown. Under the OnChange event i am using the following code ( i have tried this code under OnSelect event as well )

UpdateContext(
    {
        CPIModPropertyContext3: LookUp(
            '[dbo].[CPI]',
            CPI_Name_ID = Value(CPI_Mod_List_Label2.Text)
        )
    }
)

I want to load the values in textboxes and in other dropdowns based on the value when it changes in combo box. In the default value of the text value, I am using 

CPIModPropertyContext3.DatabaseValue

I want to change the value of textbox and other controls on form when a different value is selected in Combo box download. Can any PowerApps guru help me here please? 

I also wanted to know that the primary key in table is an autogenerated number. I want to display that in the combobox but even though i have connected the table as datasource of combobox, still that field ID which is auto-generated is not appearning in combobox, can you also help with this as well please

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

hi @Anonymous,

First issue:

Can you share a bit more about your issue?

Do you want to load values in text box and other dropdowns based on the selected value within the combo box in the same screen?

 

I made a test.

I create a SQL table named CPI.” ID field and CPI_Name_ID field are both number .column2 field is varchar.

2.PNG

4.PNG

Set the Onchange property of combo box to:

UpdateContext({CPIModPropertyContext3: LookUp('[dbo].[CPI]',ComboBox1.Selected.column2=column2)})

Set the default property of textinput control to:

CPIModPropertyContext3.ID

Set the items property of dropdown control to:

CPIModPropertyContext3

 

Second issue:

Do you also want to display a auto-generated column (int type) within the Combo Box control?

Currently, the auto-generated column (int type) is not supported within Combo Box control.

 

regards,

eason

Community Support Team _ Eason YU
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Community Support
Community Support

hi @Anonymous,

First issue:

Can you share a bit more about your issue?

Do you want to load values in text box and other dropdowns based on the selected value within the combo box in the same screen?

 

I made a test.

I create a SQL table named CPI.” ID field and CPI_Name_ID field are both number .column2 field is varchar.

2.PNG

4.PNG

Set the Onchange property of combo box to:

UpdateContext({CPIModPropertyContext3: LookUp('[dbo].[CPI]',ComboBox1.Selected.column2=column2)})

Set the default property of textinput control to:

CPIModPropertyContext3.ID

Set the items property of dropdown control to:

CPIModPropertyContext3

 

Second issue:

Do you also want to display a auto-generated column (int type) within the Combo Box control?

Currently, the auto-generated column (int type) is not supported within Combo Box control.

 

regards,

eason

Community Support Team _ Eason YU
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (8,343)