Write row value

How to write a current row value into excel

for example
loop through the datatable check if condition for example if the column value greater the 10 means the current row value is write into the excel if not the row value is write it to the another sheet of same excel

Hello,

here is info about it, assuming you already have the condition what you need is the following:

Fakturadetaljer is the datatable obtained by using a read range activity on the file you are working:

Hi,

I am trying to extract those values from all the columns of a datable where totalamount>200.
Which condition should be applied in the condition part?

Hi @SHAISTA,
Try to convert the value to int.
Convert.ToInt32(MyRow.Value)>300

Regards,
Arivu :slight_smile:

@arivu96 It says ‘Value’ is not a member of integer.

Convert.ToInt32(MyRow.Tostring)>300

I want to know that if i use get row item activity then i will get the value of a particular column only. If i want to extract the data of whole row whole amount>200.Then what should i do??
Something like add data row could work ? :open_mouth:

Hi @SHAISTA,

Use column name .
After for Loop use this code in if condition
Convert.ToInt32(row("ColumnName").ToString())>200

Regards,
Arivu :slight_smile:

@arivu Can i give multiple column names in this?

Yes you can access the all values
row(“Column1”),
row(“Column2”)

Hi shaista,

use something like this
SortedDebitTable=dtRange.Select(“C.D.Falg = ‘D’”).copytoDatatable Here C.D.Falg is a column name and it contains C,D etc but I want to filter based on D.
Based on this it will fetch all the values from that table matching with the condition

1 Like

Hi @aamir @arivu96

I have used another method to find the values>200. But i am getting the output in different form.

Hi @SHAISTA,
Use the below code to get the above 200 value from the datatable.
If you use this on no need to use for each row activity.using below code to get the filtered value.
Dt=Dt.Select("[total amount]> 200").CopyToDataTable()

If you want to convert the column to int use below code
Dt=Dt.Select("Convert([total amount],System.Int32)> 200").CopyToDataTable()

If suppose the total value is decimal value use below code
Dt=Dt.Select("Convert([total amount],System.Decimal)> 200").CopyToDataTable()

After getting this value you can write it into excel sheet using write range activity.

Regards,
Arivu:-)

1 Like

Yes it worked.
Thank you so much :slight_smile: