UiPath | LINQ XML | Read XML using LINQ | Convert XML to DataTable | Loop XML Elements / Attributes

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ก.ย. 2024

ความคิดเห็น • 23

  • @roshank9
    @roshank9 2 ปีที่แล้ว +1

    It's really needed in real time UI Path coding. Thanks for sharing this :)

    • @ActAutomate
      @ActAutomate  2 ปีที่แล้ว

      Thank you too for support Roshan :-)

  • @The.SpiritualScientist
    @The.SpiritualScientist 2 ปีที่แล้ว +2

    Your videos are really amazing. Thanks a lot for sharing this. Very clearly explained in easy to understand way. Great work!!

    • @ActAutomate
      @ActAutomate  2 ปีที่แล้ว

      Thanks Dinesh 😉
      You can support me if you share the channel with your friends

  • @rhiran9019
    @rhiran9019 2 ปีที่แล้ว +1

    Thanks a lot for your clear explanation sir. Had been in search of a best video for LINQ for a long time. And at last I came across your videos on LINQ last week and I am completely satisfied that I have some knowledge on the same now. It's all because of your efforts sir. Keep rocking and post more videos on API, integrations, AI fabric, etc. Want to learn them from your teaching. Thanks again

    • @ActAutomate
      @ActAutomate  2 ปีที่แล้ว

      Very happy to hear that.
      You can also invite your friends to learn LINQ with me on my channel to help me further for creating new videos and new ideas, how to use LINQ in UiPath.
      API etc. videos are the next videos, what I will create in the next year

    • @rhiran9019
      @rhiran9019 2 ปีที่แล้ว

      @@ActAutomate thanks much sir. Waiting for your videos.

  • @fwziayasser4510
    @fwziayasser4510 2 ปีที่แล้ว +1

    Thanks alot for the video.Very clearly explained in easy to understand way.U r Great !

    • @ActAutomate
      @ActAutomate  2 ปีที่แล้ว

      Thanks alot Fwzia :)

  • @muralikothapalli
    @muralikothapalli 2 หลายเดือนก่อน

    Awesome content

  • @UiPathUser
    @UiPathUser ปีที่แล้ว +1

    Ahh the option to read XML to datatable is so easy and nice - i hate writing complicated code hahah

    • @ActAutomate
      @ActAutomate  ปีที่แล้ว

      Happy to hear that :-)

  • @vijaychandrakanth5523
    @vijaychandrakanth5523 ปีที่แล้ว +1

    Awesome Content!!!
    I have a question. In your example, all the Customer elements had ID, Name, City and City Name as child elements. If suppose, for one of the Customer element, the Name element tag is not available. In such cases when we try to access the Name element, it is throwing an error "Object Reference Not Set To An Instance Of An Object". How to handle such cases?

    • @ActAutomate
      @ActAutomate  ปีที่แล้ว

      Please check the following video about the method: DefaultIfEmpty --> th-cam.com/video/aXFr_LVbVWc/w-d-xo.html
      You can use this method to return the default value in case the element doesn't exist.
      You can use it with a default value, for example: DefaultIfEmpty("No name found")
      In this way, you will get No name found instead of an exception.
      You can also use If statement to check if the element exists before reading it, then you can get the value if the element exists.

    • @vijaychandrakanth5523
      @vijaychandrakanth5523 ปีที่แล้ว +1

      Will try that.. Thank you so much!!!

  • @echonow5157
    @echonow5157 ปีที่แล้ว +1

    how to get subchild value using Let .Example in your xml if customerid=5 have two cars - porsche Tesla .How to pass Tesla into columnB and Porsche to ColumnA to same row in datatable?

    • @echonow5157
      @echonow5157 ปีที่แล้ว

      thank u for the like.Pls provide solution

    • @ActAutomate
      @ActAutomate  ปีที่แล้ว

      It's not easy to explain here, because you need a new query and you need to write it in Invoke Code activity, so that you can do more steps in easier way.
      Here is the idea how to do that:
      You need for the name:
      Let names = el.Elements("CityName").Select(Function(name) name.Value)
      in this way you have an array containing the names of one element.
      Now the query should be like this one:
      Dim customers = From el In xDoc.Descendants("Customer")
      Let id = CStr(el.Attribute("ID"))
      Let name = CStr(el.Element("Name"))
      Let cityNames = el.Elements("CityName").Select(Function(name) name.Value)
      Let zip = CStr(el.Element("City").Element("Zip"))
      Select New With {
      .ID = id,
      .Name = name,
      .CityNames = cityNames,
      .ZIP= zip
      }
      For Each customer In customers
      For Each cityname In customer.CityNames
      customersTable.Rows.Add(customer.ID, customer.Name, cityname , customer.ZIP)
      Next
      Next

  • @princeflamezy8188
    @princeflamezy8188 ปีที่แล้ว +2

    Great Tutorial. But I'm facing an error that says "Assign: Object reference not set to an instance of an object".
    This happens when my automation get to the reading of xml into data table.
    I declared the variable and made query as I should but still can't get past this error. Please help.

    • @ActAutomate
      @ActAutomate  ปีที่แล้ว

      This error occurs in case you are trying to read an element, that doesn't exist.
      For example, each customer element should have element name. But somehow is a customer element without name element. In this case you get an exception.
      This is only an example, but there are different reasons for the error.
      What I can recommend is to use DefaultIfEmpty method. There is a video about this method, how to use in details. There are also other videos about XML with LINQ. Please search for XML on my channel and watch all videos to get better understanding of the topic.
      If you still have any questions, please let me know

    • @princeflamezy8188
      @princeflamezy8188 ปีที่แล้ว

      @@ActAutomate Alright. I'll do that. Anyway....I took me a lot of time to figure out but It worked perfectly after I built the table before running the queries.
      I hope this helps someone.

  • @DrzymalaWagon
    @DrzymalaWagon 2 ปีที่แล้ว +1

    Great video as always, do you mind telling what is the voice synthesizer that you are using?

    • @ActAutomate
      @ActAutomate  2 ปีที่แล้ว

      Thanks man :-)
      Try *fiverr* ;-)