Hello, I have a question about utilizing the Regex method to extract PDF data into Excel.
I have a flow to extraction that I built (see attch main.xaml), however all of the data I’ve extracted so far is accurate, but in item number, it has only been recorded in a single line.
extract.xlsx (8.8 KB)
The item number is expected to be able to collect all the data in the next row, as shown below.
Please Advise. thanks.
Main.xaml (21.8 KB)
As per the flow you are extracting the item only once and even if gets multiple matches you are using first result
you should be using matches output to get all matches and also for each match you need to add a data row for that you can use a loop to get more rows again
still no clue for this, can you give me detail? thanks
Results will give multiple matches and first match as the name suggests will give only the first match…that is the reason you get the item Id only once
Hmm…in regexr, for this regex already capture all the data (seven matches), why is it only one matches that capture and extract to Excel only one line, and what supposed i need to do? thanks Anil.
When you use Find Matching Patterns activity and store the output the datatype of the output will be System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Match>
Use an for each Loop activity to print all the matching values in the excel using activities.
Hope it helps!!
All matches will come in results…
First match will come in first
And when you get multiple matches you need to use for loop and loop through each match and add a data row for the same
pardon, i’m try like this, but the result its only all same.
So As per your previous screenshot if you need each row to be populated…not only the itemid but all columns…
then the loop must be on one of the itews which works for the current loop you are using…
apart from that you need to loop other items as well…all are used as first values only…so only first is coming…if you want each row…then use
matches(index).value here index is a variable which is created in the for loop properties…if you open properties you will see a index
but again…few rows dont have values…you should manage them as well
i try to capture only the item number, so i have created like this
results like below
You need to follow these steps only. Create the output variable in Result property of matches activity and run the for each loop for that.
Hope it helps!!
i did,the result its like below, all capture data its same value.
You have to assign variable to results say output
Now give output variable as inargument in for loop
And in add data row Use currentitem
If possible share your workflow so that error can be sorted out.
View the flow I created. and I must extract to become like the one below.
main.xaml (23.0 KB)
from what i created, in item number columns its only capture just one item, the rest its not taken.
You have created the output variable in first match. So it’s printing only first match value. Create the variable in Result. It will print all the matching values. Hope it helps!!
i have create variable in properties Matches , Result, as mention, still warning like below
Add .tostring to that. and if you have multiple matches for every regex expression you need to change all the variable.
the result, like below,
please see my flow, is there mistaken or not,
main.xaml (23.2 KB)
For every Regex expression you create an variable you need to run an For each loop for every expression.
Intialize an count variable and initialize to 1
In the for each activity increment the counter by 1.
Use Write cell Workbook activity and specify the cell + countervariable.toString