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/
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
how can i do that sir? thank you!
can you send the oml sir?
You can check this. I see that you have other logic and I leave it still.
YES sir been trying other ver. thank for this!
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.
ThanksDeep
how can i do this sir? thanks!
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.
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.
thank you for this much sir. ive been learning from the data actions its new to me. thank you very much sir
sir ive tried it but the ncr showing blank?
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.
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!