cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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
Highlighted
Community Support
Community Support

Re: Help populating text box based on value of drop down

hi @FaisalAkbar,

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
Highlighted
Community Support
Community Support

Re: Help populating text box based on value of drop down

hi @FaisalAkbar,

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
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

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