The output is coming out as ItemNamesRaw an IEnumberable variable for the first Matches activity and as QtyRaw which is an IEnumrable variable for the second Matches activity on the same PDF.
Currently I just have: For Each Item in the Variable converted to string and writing a line to be sure that they are all being read correctly.
I would like to have them append columns in an excel spreadsheet for inventory purposes, (all items to column A and all Qtys to Column B for example) but Iām having trouble figuring out how to convert the IEnumerable into a DataTable as thatās what is required to append a range.
1. Should I be aiming towards using Append Range to do this?
2. Is there a more meaningful and maybe flexible way to extract and collect the information within the IEnumerable so that I can access this information in the best way possible?
I donāt recall learning something specifically already that I can think of using, so maybe this is further ahead in the Academy than I am, (Iām about 25%) but even being pointed in the right direction would be great.
As always thanks for all the help on these forums, itās always quick and concise to get an answer and Iām loving the community here.
Did you try ItemNamesRaw.CopyToDataTable? (you wonāt get intellisense, but you should import System.Linq)
if you need to bifurcate your Item and Quantity, build a datatable and probably you can bifurcate by length (eg >5) or contains hyphen (-) then add to different A or Add to column B.
⦠Even if I get them both from regex and concatenate them, Iām still looking at how Iām going to get the data out of an IEnumerable of Regex though right?
If I got them into just one, concatenated⦠how would I get to that data? Isnāt it the same problem Iām having or could I do something else with that?
Hey, I saw your solution and I am looking for something similar I think, but I donāt understand the file you send.
I use a matches activity with the following regex pattern: ā\s[0-9]{23}\sā, to find all strings on a page that are 23 digits long. Now I want to filter the results so there is only unique results. I thought Iād do that by putting them in a data table or excel or something and then further filter, but I canāt figure out how to get the collection of matches into a data table/excel
Your solution is what i was looking for. But still i couldnt convert IEnumerable to Datatable.
At āAdd Data Rowā step, I am getting the below error message. Kindly help
An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.ArgumentException: Unable to cast object of type '<CastIterator>d__97`1[System.Text.RegularExpressions.Match]' to type 'System.IConvertible'.Couldn't store <System.Linq.Enumerable+<CastIterator>d__97`1[System.Text.RegularExpressions.Match]> in Email Ids Column. Expected type is Int32. ----> System.InvalidCastException: Unable to cast object of type '<CastIterator>d__97`1[System.Text.RegularExpressions.Match]' to type 'System.IConvertible'.
at System.Data.Common.Int32Storage.Set(Int32 record, Object value)
at System.Data.DataColumn.set_Item(Int32 record, Object value)
--- End of inner ExceptionDetail stack trace ---
at System.Data.DataColumn.set_Item(Int32 record, Object value)
at System.Data.DataTable.NewRecordFromArray(Object[] value)
at System.Data.DataRowCollection.Add(Object[] values)
at UiPath.Core.Activities.AddDataRow.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
Did you ever get this working? I hope so!! but if not lemme know and I can show you how to use Matches to find what you want, and you donāt need to dump the data into an excel first or anything.
Thanks for this, almost what I needed but now I am now going mad! How do I create the table if the item and quantity are not mapped and there are items where the quantity is empty