
Announcements
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
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.