How to get NUMERIC value from datatable item

Hi Forum. I’m very new to UiPath so bare with me if my question sounds stupid.

I’ve created an automation that reads a range of cells from a spreadsheet and for each item in the datatable I would like to determine if it is an even or odd number using the MOD function.

But how do I get the numeric value of the item in the datatable ?

welcome to the forum

lets assume you will iterate over the datatable (Excel was eadin with read range) with a for each row.

Following statement will return true false for it
Convert.toInt32(yourRowVar(ColumnnameOrIndex)) Mod 2 = 0

Hola @fsv

Follow these steps:

  1. Use ‘Read Range’ activity for reading excel(suppose output is dt)
  2. Use ‘For each row’ and assign ‘dt’ to it
  3. Use another assign within For Each Row[number => Parse.Int(row(YourColumnName))]
  4. Use IF with condition (number%2)==0
    4.a. Yes then its an even number
    5.a. No then its an odd number

I hope this will work

Thanks for both reply, but neither is working to great.

When debugging I’m getting the error “option Strict on prohibits convert from …”.

I can’t find that option anywhere, so what do i do now ?

can you please share the entire validation message? Thanks

Sorry, here it comes:

Compiler error(s) encountered processing expression “NummerListe”.
If Option Strict On is used, there can not be converted from ‘System.Data.DataTable’ to 'System.Collections.IEnumerable.

please ensure that you are using a for each row activity. Otherwise just show us some details to your implementation (e.g some screenshots). Thanks

Also have a look here:


find starter help here:
DT_CheckValueIsOddOrEven.xaml (7.0 KB) (8.9 KB)
Hi @fsv,
I have tried to help , please go through the workflow.

Hope this helps!!