InvokeCode to filter datatable with where

Hello friends, a query, I want to filter a datatable with a large volume of info and that is why I use the InvokeCode activity with VBNet, however, it is generating an error, I already validated and it has nothing to do with the name of columns or data, I would think that maybe it has to do with the “Contains” or “Substring” function that I use inside the where (maybe uipath doesn’t allow this)

The code I use in the InvokeCode activity is:

dt_FraudeBruto.AsEnumerable (). ToList (). where (Function (x) (not x (“FRAUD_TYPE”). ToString.Contains (“VU”)) or (x (“FRAUD_TYPE”). ToString.Substring (0,6 ) .ToString.Equals (“DEBIT”))). ToList (). ForEach (Sub (row) row (“FRAUD_TYPE”) = “DOES NOT MEET THE RULE”)

Give in advance I am very grateful for your attention and support! Thank you!


Hola,

Could you try to remove those ToList() items from your query?

Just surround the invoke activity in try catch and in catch section log a message like:

Log message = exception.InnerException.Message

the above should give the exact error message.

Also your SubString value is of 6 chars long and you are matching it with 5 chars long string (DEBIT), which is always going to be false.

1 Like

Thank You, with that I resolved the error! :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.