How to get the first few Elements from XML based on user input using LINQ in UiPath

Problem statement — We have an XML data file and need to extract the
first few elements entered by the user in a dialog box

Import system.xml and system.xml.linq to the project.

Now, add 2 assign activities to the workflow area and write the following code.

Query to Load XML file

Now, write the query to get the element the elements

Here InputNumber is the integer variable entered by the user and the query will pick the number of elements entered by the user

Let’s run the project and see the live action

YouTube: How to get the first few Elements from XML based on user input using LINQ in UiPath - YouTube

Code: UiPathSamples/20 - List the First few Elements from XML based on user input using LINQ at main · manojbatra071/UiPathSamples · GitHub

Medium: How to get the first few Elements from XML based on user input using LINQ in UiPath - Manoj Batra - Medium

Happy Automation

1 Like