Need to process only numeric values from the excel sheet

All,

I have a business requirement here,

I have an excel sheet with numeric and text data, and i want to process the same data into an application,but the business requirement is, system should only process the numeric data from excel to application,in order to achieve the same,

i have used below condition

in_TransactionItem(“CashIn”).ToString.IsNumeric Or in_TransactionItem(“OnUsCheck”).ToString.IsNumeric Or in_TransactionItem(“NotOnUsCheck”).ToString.IsNumeric

The above is returning all the items of excel sheet (numeric as well as text too)

When i try to use this condition - IsNumeric(in_TransactionItem(“CashIn”))
I am seeing this error - Cannot refer to instance member of a class …

Please help

Hi @Ram0803

Can you send me excel file for a reference?

Thanks

Hi @Ram0803

You can use the Int32.TryParse command to check whether the current value can be converted to a numeric or not…

Int32.TryParse(In_TransactionItem(“Cash_In”).ToString, IntVariable)

If you use this in a IF condition, it will return a true or a false based on the success it achieves in trying to convert it to the desired data type. If it is true, that means the string you gave is numeric. If not, it means it contains characters that cannot be converted into a numeric.

1 Like

@anandji05

Attached is the image of the excel sheet, i want to process only numeric value

Image

in_TransactionItem(“CashIn”).ToString.IsNumeric() Or in_TransactionItem(“OnUsCheck”).ToString.IsNumeric() Or in_TransactionItem(“NotOnUsCheck”).ToString.IsNumeric()

@Principal_htga and @Lahiru.Fernando

Sorry no luck, tried both the scenarios :confused:

Regards
Ram