Although we might not have the full details of your implementation or what is your end output required but there are already many posts in here that would help you in a General way to figuring out what needs to be done when extracting data from PDF and get it to a Structured format.
One of the posts is below :
It might not be the exact way that is required for your needs but there is a General method introduced that could also be used for your case
Do check it and let us know if it was helpful. But to help you more specific to your case, we might need to know more of your data format, the regex that you are already using and what has been implemented till now.
Use a for loop on ienumMatch and change type argument to Match
Now inside loop currentitem.Value will give you each value for each iteration…where you can use a add data row activity with a new datatable with one column of type string(use build datatable to have the structure) in add datarow activity give the datatable and then use {currentitem.Value}
Now after loop use write csv with the datatable then the data would be written to csv
i tried that but after populated the ienMatch variable, if I try to do a loop and WriteLine currentItem.Value i see only all the values of the second column…
but in the next activity where I have “Add to Data Row”:
sorry but i think there is a basic error on my side.
In ienMatch I have only an array of value… not both columns…
so my question should be: How can I save IENumerable variable (array of string) in a column of a DataTable?
because if I can fix that i can fix my task… i should create 2 loop…
the first one search the first regex in the PDF file and save it to ienMatch and then save it in the first column of a datatable… then another loop with the second regex… search for the second regex, save to ienMatch and then save ienMatch to the second colum.n…
@Luca09 , The expected way the Regex Expression should have been might be different. You are having two expressions separately and are trying to get each match and co-relate the match to each other (Vehicle and Total ).
But Maybe we could modify the expression to a Single Regex, where we will be able to capture different values using groups.
But we would require to know details of your Input data (Sample data) and How you would want the output to be.
and when i said that in the CSV i see only the first element… it’s because i save here only the first element:
because I loop the two column of dtData that contain 2 record , one for each regex… so i save the value of the first colum in the first round of the loop and first value of secodn column in the second and last round of the loop.
so ienMatch after loop contain only all the result of second regex because first regex is gone and overwrited…
yes, we can modify dtData with only one regex and then match strPDF (whole PDF) with one regex and save the result to ienMatch… now in ienMatch i’ll have all the result for the first regex… the same for second regex and save it to ienMatch2…
now i have ienMatch and ienMatch2… the first one with result of first regex and second one for second regex…
how can I save all these data (2 different ienum vairbale) in the same Data Table (dtOutput) to save it in a csv?