Hello all need help,- I have list with different things, like numbers and words. egxample: 1, 2, “Ram”, 3, 4, “Bob”, 5, 6. I want to take only numbers from list and multiply all of them. What type of variable I use for this list? And what var type for result?
– How can I do filtering numbers and multiply in UiPath without error?
use a variable of type List(Of Object) to hold the mixed list. For the result, use an Int32 or double variable depending on whether you expect whole numbers or decimals.
Nowfor result, apply the OfType(Of Int32) method on the list to get only integers, then use Aggregate to multiply all elements,
something like this: YourList.OfType(Of Int32)().Aggregate(Function(acc, x) acc * x).
Pls modify accordingly and try first.