cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ARAlmac
Helper II
Helper II

Best way to Use Country Flags in PowerApps?

Hi PowerApps,

 

I am developing an app for users to request access to a Blocked Microsoft Location so they can sign in to M365.

On the App, the user creates a request and if they select "France" I would like the France flag to save as an image to the SharePoint List with that request record so that in the Requests Gallery you can see the Flag as the image. 

 

I also have an admin section where admins can add new Blocked Countries to the List - I would like them to be able to add the Country name and image flag to the "Blocked Locations" SP list i have set up.

 

I have been working away trying to get a solution but I cant seem to get either of these.

 

 

 

Can anyone help?

1 ACCEPTED SOLUTION

Accepted Solutions
CarlosFigueira
Power Apps
Power Apps

You don't need to add the country image to the SharePoint list; instead, you can have a collection locally in your app that correlates the countries with their respective images. For example, if you have this in your App's OnStart property:

 

 

ClearCollect(
  CountryFlags;
  { Name: "France", Flag: "https://upload.wikimedia.org/wikipedia/en/thumb/c/c3/Flag_of_France.svg/1280px-Flag_of_France.svg.png" },
  { Name: "Azerbaijan", Flag: "https://upload.wikimedia.org/wikipedia/commons/thumb/7/74/Flag_of_Azerbaijan_%283-2%29.svg/1280px-Flag_of_Azerbaijan_%283-2%29.svg.png" },
  { Name: "Bulgaria", Flag: "https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Flag_of_Bulgaria.svg/1920px-Flag_of_Bulgaria.svg.png" },
  { Name: "Germany", Flag: "https://upload.wikimedia.org/wikipedia/en/thumb/b/ba/Flag_of_Germany.svg/1280px-Flag_of_Germany.svg.png" })

 

 

You can have in your gallery's image an expression that performs a LookUp in that collection, something like

 

 

LookUp(CountryFlags, Name = ThisItem.Country, Flag)

 

 

If you need to use this "flag lookup" in other apps you can also have it as an Excel table (that is imported statically to the app) or even in a separate SharePoint list.

The attached app shows an example of this technique. To open it, save it locally, then go to https://create.powerapps.com, select Open, Browse, and find the file that you previously saved.

Hope this helps!

View solution in original post

2 REPLIES 2
CarlosFigueira
Power Apps
Power Apps

You don't need to add the country image to the SharePoint list; instead, you can have a collection locally in your app that correlates the countries with their respective images. For example, if you have this in your App's OnStart property:

 

 

ClearCollect(
  CountryFlags;
  { Name: "France", Flag: "https://upload.wikimedia.org/wikipedia/en/thumb/c/c3/Flag_of_France.svg/1280px-Flag_of_France.svg.png" },
  { Name: "Azerbaijan", Flag: "https://upload.wikimedia.org/wikipedia/commons/thumb/7/74/Flag_of_Azerbaijan_%283-2%29.svg/1280px-Flag_of_Azerbaijan_%283-2%29.svg.png" },
  { Name: "Bulgaria", Flag: "https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Flag_of_Bulgaria.svg/1920px-Flag_of_Bulgaria.svg.png" },
  { Name: "Germany", Flag: "https://upload.wikimedia.org/wikipedia/en/thumb/b/ba/Flag_of_Germany.svg/1280px-Flag_of_Germany.svg.png" })

 

 

You can have in your gallery's image an expression that performs a LookUp in that collection, something like

 

 

LookUp(CountryFlags, Name = ThisItem.Country, Flag)

 

 

If you need to use this "flag lookup" in other apps you can also have it as an Excel table (that is imported statically to the app) or even in a separate SharePoint list.

The attached app shows an example of this technique. To open it, save it locally, then go to https://create.powerapps.com, select Open, Browse, and find the file that you previously saved.

Hope this helps!

apomark
Frequent Visitor

Here is a blog post on how to do this.  

https://medium.com/marek-pikosz/power-apps-display-any-countrys-flag-8b78c570b065
Above method allow to display any country flag without the need to have all flag images stored in Power Apps or database.

flags1.gif

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,998)