Single row in dt shows as three rows

Hello,

When I go through each row in a data table after extracting an address from a website, the entire address is extracted as one row. When I look at the output panel, that one row appears as 3 rows. How do I extract each line individually? For example, if I wanted a variable just for the street, a variable for the city, a variable for the state, and a variable for the zip?

Any help would be greatly appriciated.
Thank you!

looks like the data column value is a string with line breaks

we can split by:

Assign Activity:
arrLines =

CurrentRow("YourAddressColName").toString.Trim.Split({Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)

similar to the linebreak split we can repeat it on the line values for a split on comma

Alternates are to replace in the origin string line breaks and comma with a dedicated chararacter (e.g. |) and then split it on this character

Hi Peter! Thanks for the reply.

Hmm, Did I do this wrong? Sort of looks the same.

we cannot derrive all details from your screenshots. Also we are in doubts, why it is nested looped over the itemArray

debuging / prototyping we can do within the debugging panels e.g immediate panel

also have a look here:
grafik

strText = CurrentRow(“YourAdrssColNameOrIndex”).toString.Trim

arrValues =

System.Text.RegularExpressions.Regex.Split(strText,"\r?\n|,").select(function (x) x.Trim).ToArray
1 Like

No real reason for the nesting. I was trying other ideas from different forum posts. I think we’re getting closer though!

Would this then be followed by a “for each” loop to go through each string?

Then, for the “State Zip” string, would I need to use RegEx to split that up, too? Sorry, I haven’t used RegEx very much.

we have split and it depends on what you will later do for processing

  • we can loop
  • we can access directly

grafik

1 Like
1 Like

Oh ok great! Now that I think of it, accessing directly might be the way to go. We may run into addresses that have a “street line 2” for things like apartment numbers, so I could do an “if” statement for how many results I get in the array…

This has been a huge help, thank you so much!!

have a look for the length retrieval
grafik

1 Like

That’s perfect, thank you so much!

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