How add string variables from Find Children loop to Data Table?

Greetings everyone,
I found several other topics that touched on what I was having issues with, but didn’t seem to actually apply or the suggestions didn’t fix my issue. So here we go:

My current workflow is:

  • Build Data Table activity
    – 2 columns for the aaname item (String) and the OuterHtml (String) item
    – Data Table variable named “UBCdatatable”
    v
  • Open Browser activity
    – website is “One Trade, Many Crafts - United Brotherhood of Carpenters
    v
  • Find Children activity
    – Filter: “< webctrl tag=‘A’ />”
    – Scope: FindScope.FIND_DESCENDANTS
    – Output is iEnumberable named “UCBchildren”
    v
  • For Each activity
    – For Each item in UCBchildren
    • Get Attribute activity
      – Element is an item
      – “aaname”
      – Output is a string variable (“aanameAttribute”)
      v
    • Add Data Row activity
      – ArrayRow: {aanameAttribute}
      – DataTable: {UBCdatatable}
      v
    • Get Attribute activity
      – Element is an item
      – "“outerHtml”
      – Output is a string variable
      v
    • Add Data Row activity
      – ArrayRow: {OuterHtmlAttribute}
      – DataTable: {UBCdatatable}

My goal is to get to a table that looks like this:
aaname OuterHtml
[aaname1] [OuterHtml1]
[aaname2] [OuterHtml2]
[aaname3] [OuterHtml3]

With the Log message activity, I can see the Find Children loop + Get Attribute activity works and gives an output of the aaname and the outerHtml for each link that I’m interested in documenting.

The issue arises when I try to add the string variables to the data table. I have no clue what is wrong, it just doesn’t do anything when I try to debug the file.

  • I’ve tried the Assign activity to try to assign row(0) to the aanameAttribute variable, but it doesn’t seem to like whatever I’m doing with that either
  • I’ve tried using the UBCdatatable.Rows(0)(0) format some people have suggested in other threads, but it doesn’t seem to fix the issue (I’m unsure if this would put each new item in the loop on the next row of the same column or just overwrite the previous cell)
  • I’m wondering if there’s a way to just make each variable it’s own data table and then just be intentional about were I write the range to excel.

It’s always something small with UiPath and I’m obviously still new to it, so I’d appreciate any help that anyone could provide.
Thank you!
Nic

Hi @Info_Support

Try this modified Workflow

  • Build Data Table activity
    – 2 columns for the aaname item (String) and the OuterHtml (String) item
    – Data Table variable named “UBCdatatable”
    v
  • Open Browser activity
    – website is “Our Crafts •
    v
  • Find Children activity
    – Filter: “< webctrl tag=‘A’ />”
    – Scope: FindScope.FIND_DESCENDANTS
    – Output is iEnumberable named “UCBchildren”
    v
  • For Each activity
    – For Each item in UCBchildren
    • Get Attribute activity
      – Element is an item
      – “aaname”
      – Output is a string variable (“aanameAttribute”)

    • Get Attribute activity
      – Element is an item
      – "“outerHtml”
      – Output is a string variable
      v

    • Add Data Row activity
      – ArrayRow: { aanameAttribute, OuterHtmlAttribute}
      – DataTable: {UBCdatatable}

That seems to have done it. Thank you so much!
Nic

Hi @Info_Support

Mark it as solution if it resolves ur query

Regards

Nived N :robot:

Happy Automation :relaxed::relaxed::relaxed:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.