How to remove the blank value from get attribute

I am using find children activity where I want to iterate through the H4 tag and get the value from it. While iterate through for each using get attribute I am getting blank data also. So is there any vb.net expression or way where I can declare if the value is blank then ignore the other should be written in excel.

Please find the attached image.

You can check it in the UiPath itself like

if the variable or the expression value is string.Empty or “”, then skip else write @Saahil08

Hey @Saahil08

Use an If activity.
Then the condition would be:
String.IsNullOrEmpty(yourStringVarHere)
It will return a Boolean

3 Likes

@Saahil08
With A LINQ Statement it is easy to filter out the empty ones from the List returned from find children.
Lets assume text is in the text attribute:
Assign Activity:
Value: YourFindChildrenOutputVar.Where(Function (uie) not String.IsNullOrEmpty(uie.Get(“text”).ToString)).ToList
To: Variable of e.g. List(Of uielement)

Kindly Note: With this approach you dont need for each activity

Hi, I am unable to understand your code it looks little complicated. And I am using for each activity where I am iterating through a find children output and trying to get the content from a page using get attribute.

Hi jan, can you please simplify here with variable name as i am not getting what the actual condition to supply.

1 Like

@Saahil08
Can you post a screenshot from your for each, would be helpfully for further guidance.

In for each yout can retrive the value from H4 via:

  • get attribute acitvity (text property)
  • or via Assign Activity uielementVarFromIteration.Get(“text”).toString

so you can check if H4 is blank by eg

  • String.IsNullOrEmpty(uie.Get(“text”).ToString)
    or String.IsNullOrEmpty(YourH4TextVariable)

My statement from above is filtering for all non blank items in a oneliner and doesn’t need a foreach. Later you can process the filtered list in a foreach again and eg get content from a page

You can check this documentation:

3 Likes