HOW CAN I GET DEFAULTVEIW DATATABLE WITH ALL THE OTHER DETAILS?

HI Team,

I am working on a datatable where I have the following samlple:-
Name Age
A 20
B 30
C 40
A 45
B 29
D 56

So the resultant data table includes:-
A 20
B 30
C 40
D 56

I have done the below approach:-
I have DTSample

I used write range:- where I wrote → DTSample.DefaultView.ToTable(True,“Name”)

And I got only the Distinct names , which works fine with me, But I need Name + age instead of only names.
I know this is silly one but still.

Please help.

Thanks and regards,
@hacky

1 Like

@hacky

Try this:

DTSample.DefaultView.ToTable(True,“Name”,“Age”).CopyToDataTable

The result is dataTable then use Write Range activity to write into Excel file.

3 Likes

@lakshman

Does this logic fetch the result which is unique with respect to Name or what ?

I need the unique keys with respect to name.
If your code satisfies this condition, kindly let me know where do we mention that the distinct values are with respect to name (as we have mentioned both, name and age
)