i have one excel file with salary details column. i want to extract the data from excel file, those who are getting salary more then 30,000 in one excel sheet and those who are getting salary less then 30,000 in another excel sheet???
@MKRoy, Declare your datatable as dt.
Filtering (Assign Activity)
Datatable dtLessthan30000 = dt.Select(“Convert(ColumnName,System.Double) <
Datatable dtMorethan30000 = dt.Select(“Convert(ColumnName,System.Double) > ‘30000’”).CopyToDatatable
Output (Write Range)
- Write dtLessthan30000 in sheet1
- Write dtMorethan30000 in sheet2
Note: Conversion used is a preventive measure ! Even if your column is in string or someother datatype this will convert it to a double format. If your column is already in integer/double, giving your columnName alone is good enough.
I hope it will work for you
Thank You so much Dominic. Still i am facing little problem. I am attaching screen shots. when i was using assign activity but i got an error of cannot assign from type ‘System.Data.DataRow’ to type ‘System.Data.DataTable’.
@MKRoy, Think you have forgotten to use this after the query.
If not you might have declared dtLessthan30000 and dtMorethan30000 as Datarow
Thank you Manish for help!!!
Hello Dominic, one more error is coming. That is “cannot find coulmname”
@MKRoy, You need to replace the columnName with your columnName (like salary details)
ya…i have done that thing earlier only. In my excel file i have name, salary and job column and assign activity i have given ‘dt.Select(“convert(Salary,System.Double)<‘30000’”).CopyToDatatable’. Before assign activity i have used read range from their only ‘cannot find coulmn name’
@MKRoy, Confirm once that you have checked Add Headers property in read range. If not enusre there is/are no space(s) in the column name.
Thanks…Dominic. It is working now.Once again thank you very much.