web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How do I generate an x...
Power Apps
Unanswered

How do I generate an xml file from data captured?

(0) ShareShare
ReportReport
Posted on by 301

I have an PowerApps app that accepts data from users, and I am patching the data into a SharePoint list...

Patch(SharePointListName, Defaults(SharePointListName),
 { user_info: Concatenate(
 first_name.Text," , ",
 middle_initial.Text," , ",
 last_name.Text," , ",
 nickname.Text," , "
 ),
		section_req: Concatenate(
 Radio_Status.Selected.Value
 ),
		requestors_info: Concatenate(
 requestors_name.Text," , ",
 phone_number.Text," , ",
 additional_comments.Text," , ",
 Dmanager.Text," , "
 )
 }
)

I want to be able to generate an xml, and I don't know how to get this going. My requirement is to get an xml file like this...

<my:myFields xml:lang="en-US" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
	<my:section_1>
		<my:type>1</my:option_type>
	</my:section_request_type>
	<my:section_user_info>
		<my:text_first_name>Ken</my:text_first_name>
		<my:text_middle_initial></my:text_middle_initial>
		<my:text_last_name>Ryu</my:text_last_name>
		<my:text_nickname>ShoRyuKen</my:text_nickname>
		<my:text_job_title></my:text_job_title>
	</my:section_user_info>
	<my:section_req>
		<my:option_employee_status>Full</my:option_employee_status>
		<my:section_contract_term>
	</my:section_req>
	<my:section_requestors_info>
		<my:text_requestors_name>Shang Tsung</my:text_requestors_name>
		<my:text_requestors_phone_number>800.555.5555</my:text_requestors_phone_number>
		<my:rtext_additional_comments></my:rtext_additional_comments>
		<my:text_manager>Shao Kahn</my:text_manager>
	</my:section_requestors_info>
</my:myFields>

Is there a way to get this out of the SharePoint list entry? Or is there a way of getting this done directly in PowerApps?

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Spawn10 

    There is no direct way in PowerApps to get that converted into XML.

    Your best choice in PowerApps would be to Concatenate the XML and build it based on the values in your record. Similar to what you are doing in your patch.

    Concatenate("<my:section_user_info>
    		<my:text_first_name>", first_name.Text, "</my:text_first_name>
    		<my:text_middle_initial>", middle_initial.Text, "</my:text_middle_initial>
    		<my:text_last_name>", last_name.Text, "Ryu</my:text_last_name>
    … and so forth

    You can put that formula on in a TextInput control or a label or wherever you want so you can reference it and see it, or just put it in a variable as well.

     

    I hope this is helpful for you.

  • v-xida-msft Profile Picture
    on at

    Hi @Spawn10 ,

    Could you please share a bit more about your scenario?

    Do you want to generate a xml data/file based on a data entry within your app?

     

    If you want to generate a xml data/file based on a data entry within your app, I afraid that there is no way to achieve your needs in PowerApps currently.

    There is no way or functions supported within PowerApps to convert a data entry into a xml data/file. If you would like this feature to be added in PowerApps, please consider submit an idea to PowerApps Ideas Forum:
    https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

     

    As an alternative solution, you could consider generate a xml string within your app with related data from users, then pass the generated xml string value into a flow (Microsoft Flow), within the flow, you could use the genrated xml string value to create a xml file.

    I have made a test on my side, please take a try with the following workaround:

    Microsoft Flow's configuration as below:4.JPG

    Within the "Create file" action, you need to specify the parameters you want to pass from your app to this flow using the "Ask in PowerApps" dynamic content.

     

    PowerApps app's configuration as below:5.JPG

    Set the OnSelect property of the "Fire Flow" button to following:

    '20190613_case1'.Run("PowerAppsTest.xml", "<?xml version='1.0' ?><root><name>PowerApps</name><executor>Kris</executor></root>")

    On your side, you need to create a connection to above flow within your app, then add a "Button" within your app, set the OnSelect property of the "Button" to following:

    'YourFlowName'.Run(
     "PowerAppsTest.xml", /* <-- Type your xml file name e.g. xxx.xml  */
     "<my:myFields xml:lang='en-US' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' >
    	 <my:section_request_type>
    		 <my:type>1</my:type>
    	 </my:section_request_type>
    	 <my:section_user_info>
    		 <my:text_first_name>" & first_name.Text & " </my:text_first_name>
    		 <my:text_middle_initial>" & middle_initial.Text & "</my:text_middle_initial>
    		 <my:text_last_name>" & last_name.Text & "</my:text_last_name>
    		 <my:text_nickname>" & nickname.Text & "</my:text_nickname>
    		 <my:text_job_title></my:text_job_title>
    	 </my:section_user_info>
    	 <my:section_req>
    		 <my_employee_status>" & Radio_Status.Selected.Value & "</my_employee_status>
    		 <my:section_contract_term>
    	 </my:section_req>
    	 <my:section_requestors_info>
    		 <my:text_requestors_name>" & requestors_name.Text & "</my:text_requestors_name>
    		 <my:text_requestors_phone_number>" & phone_number.Text & "</my:text_requestors_phone_number>
    		 <my:rtext_additional_comments>" & additional_comments.Text & "</my:rtext_additional_comments>
    		 <my:text_manager>" & Dmanager.Text & "</my:text_manager>
    	 </my:section_requestors_info>
     </my:myFields>"
    )

    Note: Please replace the double quotes ("") within your generated xml string value with single quote ('').

     

    More details about firing a flow from an app, please check the following article or video:

    Start a flow from a canvas app

    https://www.youtube.com/watch?v=1wl9AtxWdkg

     

    When you press the "Fire Flow" button within your app, it would fire a flow, and pass the specified parameters to your flow. Within your flow, it would create a xml file based on passed xml file name and xml file string content. The flow would be executed as below:6.JPG

    7.JPG

     

    Please take a try with above solution, then check if the issue is solved.

     

    Best regards,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard