web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Populate textfield wit...
Power Apps
Answered

Populate textfield with combo box default value

(0) ShareShare
ReportReport
Posted on by 46

Hi,

 

I have a form with 2 combo boxes and 1 text field (ComboBox5, ComboBox6 and TextInput2)  "ComboBox6"  further filters the results based on the input of "ComboBox5" using the following code; "Filter('SourceTable', 'FieldName' = ComboBox5.Selected.FieldName)".

The text field is populated based on the selected item in "ComboBox6" using the following code; "ComboBox6.Selected.'FieldName'"

So far everything is working fine.

 

My issue;

In some cases "ComboBox6" will only return 1 item based on the "ComboBox5" input. In that case I would like to auto-populate  "TextInput2". How could I achieve this?

 

Vincent

 

 

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @VincentSP 

    Please consider changing your Formula on the TextInput2 Default property to the following:

    With({items: Filter('SourceTable', 'FieldName' = ComboBox5.Selected.FieldName)},
     
     If(CountRows(items)=1, First(items).'FieldName',
     ComboBox6.Selected.'FieldName'
     )
    ) 
     

     

    I hope this is helpful for you. 

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @VincentSP 

    Try setting this as the formula in the TextInput control's Default property:

     

     If(
     CountRows(
     Filter(sourcetable, field= ComboBox5.Selected.field
     )
     ) = 1,
     LookUp(
     sourcetable,field = ComboBox5.Selected.field, field
     ),
     Combobox6.Selected.field
     )
    

     

    It's off the top of my head but you could substitute in your sourcetable and fields and see if it works. It should because if the CountRow() is not 1, then a value in the second combobox will need to be selected before the textinput control populates. 

  • VincentSP Profile Picture
    46 on at

    Works like a charm!! Thank you!!

  • VincentSP Profile Picture
    46 on at

    Hi Randy,

     

    Hope you can help me out.. would it be possible to hide (visible:False) ComboBox6 if only 1 item is returned based on the ComboBox5 input. I tried using the CountRows function in the visible property of ComboBox5. But without any luck..

     

    Vincent

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @VincentSP 

    Yes, this should be the Visible property formula:

    With({items: Filter('SourceTable', 'FieldName' = ComboBox5.Selected.FieldName)},
     !CountRows(items)=1
    ) 

     

  • VincentSP Profile Picture
    46 on at

    Thank you!!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 893

#2
Valantis Profile Picture

Valantis 571

#3
11manish Profile Picture

11manish 482

Last 30 days Overall leaderboard