Hi there,
is it possible to extract specific content from the Simple Fields - Formatted Table as a variable?
Like I have:
“Key,Value
“Address Line 1",“1234 Hickory Hollon Ln”
“City”,"Raleigh”
“Country”,“United States”
“State / County / Province”,"North Carolina”
“Zip Postal Code”,“27610”
I need the variable which is in Address Line 1 for a sql query, so how is it possible to only extract the street from address line 1 instead of the whole key value fields? I previously worked with RegEx-Matches but I struggle with the diversity of streets our customers provide, so it’s possible that the RegEx-match just provide one part of the street I need for the query.
I’m not exactly sure if this is what you were looking for, but if you were to read the data as a text file and then generate DataTable out of it, you can use this query to retrieve the corresponding value →
Note: I removed the quotations, we can include them if needed
dt_sampleData.AsEnumerable().Where(Function(w) w.ItemArray.Contains("Address Line 1")).Select(Function(s) dt_sampleData.Rows(dt_sampleData.Rows.IndexOf(s))("Value").ToString).FirstOrDefault()
Also I get this from the DU extraction, like there are quotations. Isn’t there a possibility to get the street “1234 Hicckory Hollon Ln” without the Address Line 1?
Ideally, it would be best to sort them out while extracting the items using Document Understanding itself, but if that doesn’t work then the solution provided below should help you out.
Assuming that the quotations are present, you can simply assign the DT.Rows(0).Item(6).ToString to a variable and generate a CSV datatable from it which can be fed into the workflow shared below →
@melanie.p , Since the Data is Clubbed together and present in the Cell, We could however alternately use a Regex to just the address data.
Below is the Regex :
(?<=Address Line 1",).*
In your case, We could use the below Expression to get the Matching value :
System.Text.RegularExpressions.Regex.Match(DT.Rows(0).Item(6).ToString,"(?<=Address Line 1"",).*",RegexOptions.IgnoreCase).Value.ToString.Replace("""","")
Apologies for not understanding the Data was of the Type Address earlier.