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!
ppr
(Peter Preuss)
June 12, 2023, 7:11pm
2
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)
ppr
(Peter Preuss)
June 12, 2023, 7:15pm
3
Josh_James:
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?
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.
ppr
(Peter Preuss)
June 12, 2023, 7:36pm
5
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:
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.
ppr
(Peter Preuss)
June 12, 2023, 7:57pm
7
we have split and it depends on what you will later do for processing
we can loop
we can access directly
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!!
ppr
(Peter Preuss)
June 12, 2023, 8:35pm
10
have a look for the length retrieval
1 Like
That’s perfect, thank you so much!
system
(system)
Closed
June 15, 2023, 8:43pm
12
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.