Considering some rows of a data table

image I have a white data table in which I have only white rows so from the screenshot, u can say that 4 rows I have in the data table but now I want to throw an exception if Product type and Transaction type in notNTT and 102. Could u guide me a bit on this…

Fine
Hope these steps would help you resolve this
—use a TRY catch activity and inside the TRY a block use excel application scope and pass the file path as input
—inside the scope use read range activity and get the output with a variable of type datatable named dt
— now use a for each row loop and pass the above variable dt as input
—inside the loop use a IF condition like this
NOT row(0).ToString.Equals(“NTT”) AND NOT row(1).ToString.Equals(“103”)
—if true it will go to THEN part where we can use a
THROW activity And mention like this
New BusinessException(“yourmessage”)
—if the exception occurs it will go to CATCH block where we can send a note to user that “there occurs a exception” with a send outlook mail activity.

Cheers @kartik_sareen

1 Like

Hi, @kartik_sareen or u can use for each row and inside use if row(1).tostring.equals(“NTT”) and row(2). tostring.equals(“102”)

1 Like

@kartik_sareen

An alternate with less required activities could look like following:

  • readin Excel into a datatable as described by Palaniyappan
  • count the occurence of NTT 102 rows
  • react on the count within a if activity

Assign Activitiy:
NTT102Count is of Datatype Int32
Statement: YourDataTableVar.AsEnumerable.Where(Function (row) row(1).ToString.Equals(“NTT”) And row(2).ToString.Equals(“102”)).Count

For Demo Purposes I used Message Boxes

Ensure that the DataSetExtenstions are available:

Thank you Palaniyappan,

I have used the same but I am geting an errorimage
compiler error
which says thats System.Data.Datatable to Systems.Collections.IEnumerable , could u help me in this .

VarWhiteDt is a data table

1 Like

Kindly use FOR EACH ROW activity
You have used FOR EACH activity
Cheers @kartik_sareen

1 Like

Thanks a lot buddy

I have a data table as mentioned above but in that I need to add all the values in the column 17.
example:image
So the position is 17th, I need to add all the values in a data table at position 17th.could u guide me a bit.

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