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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Problems selecting a d...
Power Apps
Unanswered

Problems selecting a dropdown that has a function in its Onchange property

(0) ShareShare
ReportReport
Posted on by

Hello

I am new and would greatly appreciate your help. Create a dropdown list with values ​​milligrams, kilograms, grams, etc. Inside a gallery, the idea is that when entering ml or gr the total is divided by 1000. The problem is that when selecting the function it calculates the result correctly, but the dropdown remains blank, I have to select it again so that the value of the dropdown menu. What am I doing wrong?

 

The funtion is;;

 

If(Dropofgalunidad.SelectedText.Value="mL" || Dropofgalunidad.SelectedText.Value="gr";
Parche(
colof;
ThisItem;
{
Total: Valor(Datodosis.Texto)*Valor(Datoofcantidad.Text)/1000 }
)
; Parche(
colof;
ThisItem;
{
Total: Valor(Datodosis.Text)*Valor(Datoofcantidad.Text) }

))

 

In the image I already select ml, but it does not show the selection

 

Carlos_CorderoV_0-1669648780847.png

 

 

Categories:
I have the same question (0)
  • FernandoTC Profile Picture
    222 on at

    Hi @Carlos_CorderoV 

     

    When using the OnChange property of a control that is contained within a Gallery, if the OnChange function modifies the records of the gallery, all controls of the gallery are set to default. based on what you are saying, you probably have the Default property of your dropdown set to Blank. This means that after the OnChange function is executed, the items of the gallery change and thus, the dropdwon is set to default value, which is blank.

     

    If there is a "unit" field in the data source you are using in your app, you sould set the Default property of the DropDown to that field value (ThisItem.unit for example).

     

    Then, modify the patch to change also that field in the record you are editing:

    Parche(
    	colof;
    	ThisItem;
    	{
    		Total: Valor(Datodosis.Texto)*Valor(Datoofcantidad.Text)/1000 
    		unit:Self.Selected.Value	
    	}
    )

     

    This way, when the user picks a unit, the Total and unit field are changed and then, when the dropdown is reseted, the default value is the unit of the record, which is the one you have selected!

     

    Hope this helps.

     

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard