39
Views
14
Comments
Region, Province and City Dropdown
Question
Application Type
Reactive
Service Studio Version
11.54.67 (Build 63420)
Platform Version
11.29.0 (Build 43552)

Good day!  I am using an API for my region and province and city, i've tried doing some testing but still it doesnt show. the thing is when i pick the region the province will change depends on the region and the city will change depends on the province. is there any step i missed out? thankss

here's the link for the api: https://psgc.gitlab.io/api/ 


CityMunicipality.oml
2023-02-20 05-20-57
Nam Nguyen

Hi, 

The problem is you haven't fetched the region data. The client action getRegion is never used. You can see it in the warning.

It would be best if you used DataAction to fetch API data.


You set the fetch attribute of FecthRegion: At Start. FecthGetCitiesByProvince and FecthProvincesByRegion are set Only on Demand.

These steps are guided in the Training course. The difference is you use DataAction instead of Aggregate.
Check this link: https://learn.outsystems.com/training/journeys/web-developer-662/fetching-data-on-demand/o11/488 

Nam




UserImage.jpg
budang haba

how can i do that sir? thank you!

UserImage.jpg
budang haba

can you send the oml sir?

2023-02-20 05-20-57
Nam Nguyen

You can check this. I see that you have other logic and I leave it still. 


CityMunicipality.oml
UserImage.jpg
budang haba

YES sir been trying other ver. thank for this!

2024-09-12 02-43-38
Deepsagar Dubey

Hi @budang haba 

Would you please try below API endpoints

To show all regions list -
        https://psgc.gitlab.io/api/regions/

To fetch provinces list for selected region (pass selected region code)
        https://psgc.gitlab.io/api/regions/010000000/provinces/

To fetch cities list for selected province (pass selected province code)  - 
        https://psgc.gitlab.io/api/provinces/012800000/cities/ 


Regions List from 1st API

Provinces List from 2nd API

Cities List from 3rd API

I hope it'll help you.

Thanks
Deep


UserImage.jpg
budang haba

how can i do this sir? thanks!

2024-09-12 02-43-38
Deepsagar Dubey

First create 3 REST API and call 1st one initially on your screen or block, then call 2nd API on Region dropdown on change event then call 3rd API on province dropdown on change event.

2025-02-21 07-07-34
Rishabh Tailor

Hi @budang haba ,

For fetching any data from other external sources, such as API, you should always use Data Actions.

Use their fetch property according to your needs.

Here in your case you have fetched the data from API in screen actions which is not proper. 

I placed the same flow in a Data action in assigned that list to the dropdown, and it worked as it should.

Please check the Attached OML for reference.

I hope it helps. 

CityMunicipality.oml
UserImage.jpg
budang haba

thank you for this much sir. ive been learning from the data actions its new to me. thank you very much sir

UserImage.jpg
budang haba

sir ive tried it but the ncr showing blank? 

2021-11-19 11-12-44
Rui Mendes

Hi @budang haba

I think this is what you’re looking for. 

If this is the correct solution, please click the respective button so that other members with similar problems can find the solution. 

If not, you can describe your specific case to me. 


Check the attached OML for the proposed solution.

Best regards,
Rui
CityMunicipality.oml
2022-07-03 17-24-08
Sourabh sharma

Hi budang haba ,

I have chcked you code where I have found you are not calling the action "get region" anywhere therefore you are not getting any output in your drop down , whether you call your Region action or change it to DataAction. you will get the value .Rest you have done correct!!

How to call in DataAction your region API @Rui Mendes already showed very good way.


Alos I have updated your OML kindly Check. Try

Hope it will work for you!

CityMunicipality.oml
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.