Fill Details in Input Fields based on Dropdown Selection

Hi Team,

I just wanted to learn AppGyver and working on a very basic App which shows Covid Cases.
Basically I have 1 dropdown where User will select the Country and the 3 Input fields below will show the Total Cases, Total Recovered and Total Deaths.

I built the screen, I have added the Data Source with REST API - https://coronavirus-19-api.herokuapp.com/countries/ with parameter “country”. I also added logic that on “Page Mounted” Event, Get record should be called with “country” = “World” and Set Data Variable. I have mapped these variables to the 3 Inputs. This works fine on initial load and the 3 Input fields are filled with values :slight_smile:

Now I have also coded in for Component Dropdown the same logic - On Event - “Property Selected Value Changed” then Get Record with parameter = Selected Value and Set Data Variable.
However when running the app, when I select any country from dropdown, the Input fields are not reflecting the changes. Is there anything I am missing or other way of achieving this ?


Thanks and Regards
Vivek

P.S.- I also wanted to populate the Dropdown with the Country property I am getting in OData but currently have hard coded it and just try to make this work.

just for me to understand, are you downloading all the data and then filter it based on the country or when the country is chosen, you make a new rest call and then display the new data?

Hi,

As shown in screenshot, I have put logic to call the API again with the parameter = value selected and set the Data Variable. So I am calling the API everytime new value is selected and passing it as parameter.

Thanks and Regards
Vivek

what i would do first, is to connect a toast in the end of this logic

to be sure that all the logic are executed (and not fail) when needed. Also you can add toasts in the error ports of these logic, so you can find the point of fail if any.

Also just to make sure, here you mean variable and not parameter right?

Thanks. I added the Toast and I could see that the Event “Property Selected Value Changed” was not triggered when I selected an item from the drop down. I changed the Event to “Component Tap” and now the app is working fine on my laptop browser and fetched the correct values based on country I am selecting from dropdown as it triggers the Component Tap event when I select the Country.

However, this logic is giving an issue in my mobile browser as the dropdown is displayed as a popup in my mobile browser and the Component Tap event is triggered when I tap on the dropdown but does not trigger when I select the Country from the pop-up list and hence the values are not reflected and gets reflected only when I tap the dropdown again.

Do you know which Event is actually triggered when I select a value from a dropdown list ?

Thanks and Regards
Vivek

instead, you could use the event on the page variable (connected to the dropdown) on change

1 Like

Reading through it I feel like there is no value bound to the “selected value” property of the dropdown. That should be a page variable or data variable. Anything just to have the change registered.

1 Like

Thank you @Dimos_Vamvourellis and @Mihaly_Toth . Yes I missed binding the Page Variable to the selected value. The app is working correctly now for event “page variable” is changed.

Thanks and Regards
Vivek

1 Like