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

How to load xml data in PowerApp fields

I have one xml file in below format:

<Asset AssetRegion="AllExceptFrance" Description="Furniture and Fittings"	Class="INF100" 	Default="7" Comment="" />
<Asset AssetRegion="AllExceptFrance" Description="Jetties/wharves etc"	Class="INF050" 	Default="15" Comment="" />
<Asset AssetRegion="AllExceptFrance" Description="Laboratory equipment"	Class="INF070" 	Default="7" Comment="" />
<Asset AssetRegion="AllExceptFrance" Description="Plant and equipment"	Class="INF030" 	Default="20" Comment="" />
<Asset AssetRegion="AllExceptFrance" Description="Capital Lease"	Class="INF031" 	Default="20" Comment="" />

 

Now i want to have one dropdown field which will load all the Asset Descriptions and on selecting of one it should populate that with corresponding Asset Class in another text field. How can i achieve this? I know this can be achieved by creating a SharePoint list with all these details but is there any direct way in which i can provide this xml file as data source or something similar?

1 ACCEPTED SOLUTION

Accepted Solutions
timl
Super User
Super User

@uiit3155 

There's no simple/built in way to parse XML that I know of. You could build something using the text processing functions such as Match/Regex, but there would be some complexity involved. If this is a one time conversion that you want to carry out, you can covert the XML to JSON using the help of online coverters such as this one:
https://www.freeformatter.com/xml-to-json-converter.html

 

You can then set the Items property of your dropdown to this:

Table(
  {
    AssetRegion: "AllExceptFrance",
    Description: "Furniture and Fittings",
    Default: "7",
    Class: "INF100"
  },
  {
    AssetRegion: "AllExceptFrance",
    Description: "Jetties/wharves etc",
    Default: "15",
    Class: "INF050"
  },
  {
    AssetRegion: "AllExceptFrance",
    Description: "Laboratory equipment",
    Default: "7",
    Class: "INF070"
  },
  {
    AssetRegion: "AllExceptFrance",
    Description: "Plant and equipment",
    Default: "20",
    Class: "INF030"
  },
  {
    AssetRegion: "AllExceptFrance",
    Description: "Capital Lease",
    Default: "20",
    Class: "INF031"
  }
)

 

 You can then retrieve the selected Class value by referencing Dropdown1.Selected.Class

View solution in original post

1 REPLY 1
timl
Super User
Super User

@uiit3155 

There's no simple/built in way to parse XML that I know of. You could build something using the text processing functions such as Match/Regex, but there would be some complexity involved. If this is a one time conversion that you want to carry out, you can covert the XML to JSON using the help of online coverters such as this one:
https://www.freeformatter.com/xml-to-json-converter.html

 

You can then set the Items property of your dropdown to this:

Table(
  {
    AssetRegion: "AllExceptFrance",
    Description: "Furniture and Fittings",
    Default: "7",
    Class: "INF100"
  },
  {
    AssetRegion: "AllExceptFrance",
    Description: "Jetties/wharves etc",
    Default: "15",
    Class: "INF050"
  },
  {
    AssetRegion: "AllExceptFrance",
    Description: "Laboratory equipment",
    Default: "7",
    Class: "INF070"
  },
  {
    AssetRegion: "AllExceptFrance",
    Description: "Plant and equipment",
    Default: "20",
    Class: "INF030"
  },
  {
    AssetRegion: "AllExceptFrance",
    Description: "Capital Lease",
    Default: "20",
    Class: "INF031"
  }
)

 

 You can then retrieve the selected Class value by referencing Dropdown1.Selected.Class

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Solution Authors
Top Kudoed Authors
Users online (2,365)