Your workflow looks good to me, but was wondering if you adjusted your rowSelected assignment: ExtractDataTable.Select(“[Tranno]=”+trans_number)
so with brackets
Alternative filter assignment can be like this: ExctractDataTable.AsEnumerable().Where(Function(row) row(“Tranno”).ToString=trans_number).ToArray()
If that doesn’t help, you could provide an example Excel file so we can use it with your .xaml file to check it.
hey @ClaytonM Thank you for response , attaching the scrubbed result from the targeted page , just changing the customer details for data security TPA Policies extraction.xlsx (26.4 KB)
Hey,
So I found the problem was with the ImportRow method. I’m not exactly sure why that wasn’t working.
However, you don’t really need to do that unless you have an existing table you are adding to.
So what I did was change the Assign activity to filter the rows directly to the datatable skipping over the Invoke Method. Below are screenshot and workflow.
You’ll need to change the Data Scrape and Excel Scope back to how you had it.
EDIT: I’ll also add that if you would like to process each line of the filtered data, then you can take the new dataTable variable and run that through the ForEach loop.
If you do a search on how to filter datatables in vb.net or if you know the function “where vb.net”, you can find various ways to use this. You can also find c# syntax which is the same thing as vb.net but just change the => part to Function(). You can also look at LINQ or lambda expressions in vb.net.
Alternative example of the Where using LINQ is (From row In datatable.AsEnumerable() Where row(0).ToString Equals “” Select row).CopyToDataTable()
I don’t have a really good link that explains all the different methods to manipulate datatables, but hope my tips help get the info and examples you need.
EDIT: You can use the same things with Arrays too minus the CopyToDataTable
Hey @ClaytonM ,I want to delete few rows on the basis Variable value match and then get the out in the same name of excel, please suggest, PFB XMAL with sample
Apologies, as I don’t have time with year end to provide you with .xmal samples.
Your Delete process will look like this (depending on your requirements:
Assign arrayRows = dt1.AsEnumerable.Where(Function(row) row("column1").ToString.Trim = value1 and row("column2").ToString.Trim = value2).ToArray
ForEach row In arrayRows 'with Type Argument as DataRow
Delete Row activity 'with row in the parameters to delete
So in summary, filter datatable to an array of rows that meet a condition, then run them through a loop to delete all rows from the array in the datatable.
Are you wanting to filter your table by the value “A - B”? If not, could you provide further details?
We can consider all possibilities of A - B, A-B, A- B, A -B, et cetera. Therefore, I would suggest using a pattern or multiple criteria using .Contains.
Here is a quick solution using Regex to filter your table down to all dataRows with value “A-B”:
That will return an Array of dataRows that you can process or update the original table with.
For example this psuedocode will update a column for each row in the original table using the rows,
ForEach row In arrayRows with type DataRow
Assign row("column") = "newvalue"