How to get data from datatable according to the content

hi ,

I am working on this excel what i want to do is I want to get those ticket numbers that matches the message status as – error message 51 retry

@manoj2500

Hey Use this and assign it back to a datatable.

(from dr as datarow in dt where dr.item("massage status").tostring.equals("error message 51 retry") select dr).copytodatatable

@Lakshay_Verma getting this error

@manoj2500

Use this and you do not need to use for each
dt=(from dr as datarow in dt where dr.item("massage status").tostring.equals("error message 51 retry") select dr).copytodatatable

@Lakshay_Verma

@manoj2500

Click on import and add assembly reference System.data.datatable and System.Data.DataSetExtensions

If that does not work downgrade your UiPath.System.Activities to 20.4.0

For the datasetextensions have a Look here

Ensure system.linq, system.linq.expression is imported (Imports Tab, Close to variable panel)

Shift Statement from
in dt to
in dt.asenumerable

Give a try and Let US know the feedback

2 Likes

@ppr Thanks for adding this.

@manoj2500 You have to follow above steps.

@Lakshay_Verma i added it manually now i am getting this error

i am adding the xaml Main.xaml (8.7 KB)

@manoj2500 For Handling that error, you might need to check this post :

@Manoj2500

sorry, it’s a typo… i have typed massage instead of message… Please correct this

dt= (from dr as datarow in dt where dr.item("message status").tostring.equals("error message 51 retry") select dr).copytodatatable

2 Likes

HI @manoj2500

Check the below workflow for the same. It is giving the ticket numbers that matches message status as – error message 51 retry.
MainPratik.xaml (9.3 KB)
Forum _ Manoj.xlsx (9.5 KB)

Mark as solution and like it :slight_smile:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

3 Likes

can you help me what i need to do if i need to remove this one need other status types in datatable

@manoj2500

dt= (from dr as datarow in dt where dr.item("message status").tostring<>"error message 51 retry" select dr).copytodatatable

it giving me all tickets output screenshoot

@manoj2500

write range in sheet 2

@Lakshay_Verma i am creating a new excel and passing thru write range

@manoj2500

(from dr as datarow in dt where not dr.item(“message status”).tostring.equals(“error message 51 retry”) select dr).copytodatatable

Can you try this.

1 Like

Can you try the below code?

DT = DT.AsEnumerable().Where(Function(dr) dr.Field(Of string)("message status").ToLower().Equals("error message 51 retry”)).CopyToDataTable()

hi @Lakshay_Verma @JithinGangadharan @Pratik_Wavhal

if error message 51 retry remain same and values after that are changes then what we can do get all values starting like error message 51 retry
ex. error message 51 retry by 40 gm
error message 51 retry by 76 gm