Hello all
agian i found solution in VB
> Blockquote
but not c#
i have data table want to create list of customer name without duplication ,
Then i need to query the data table against the customer name so i have small datatable with only one customer rows,
Any tips !
Hi @Hazem_Saleh ,
I believe the c# Representation would be as below :
DT.AsEnumerable().Select(r=>r("Customer Name Column").ToString()).Distinct().ToList()
Let us know if this doesn’t work
1 Like
Thanks,
i have this issue "Method name expected "
ppr
(Peter Preuss)
March 7, 2023, 2:20pm
5
DT.AsEnumerable().Select(r=>r["Customer Name Column"].ToString()).Distinct().ToList()
try [ ]
1 Like
Thanks
but cant covert list to a string!
im trying fetchDataDT_IN.AsEnumerable().Select(r=>r [“COMPANYNAME”]).select (r=>r.tostring())Distinct().ToList(); but still no luck
@Hazem_Saleh ,
We see a Difference in the expression in the Screenshot and the one you have provided in the form of text below it.
Could you double check on the expression used ?
Hazem_Saleh:
image1255×210 10.2 KB
@Hazem_Saleh ,
There is a misplace of brackets in your Expression.
Have you Checked with the Suggestion already provided above :
We don’t see this exact expression used in your workflow.
DataTable.AsEnumerable().Select(Function(x) x(“Column1”).ToString()).Distinct().ToList()
Pls try this this will work
@Hazem_Saleh if that will work then pls mark it as solution for my hard work
ppr
(Peter Preuss)
March 8, 2023, 8:38am
12
we just summarize the given inputs:
And counterchecked:
Kindly note: the needed statement ending ;
And Also:
So with the help from @supermanPunch you should finalize it and get it working, when:
statements are carefully ported to your code
any specifics (e.g. variablename, columnnames…) are edited as needed
Manish540
(Manish Shettigar)
March 8, 2023, 8:54am
13
Hi @Hazem_Saleh ,
We can have C# linq’s in the Invoke Code activity as shown below,
companyNames(List of String) = dt1.AsEnumerable().Select(ra => ra.Field<String>("COMPANYNAME")).Distinct<String>().ToList<String>();
We have to set the language to CSharp in Invoke Code activity property section as per below screenshot,
Arguments:-
Hope this may help you
4 Likes
Thanks icant find list as a type
do i need to defined it first ?
Hello again,
Is it possible to do the same but we get the datatable with the row Values!
ppr
(Peter Preuss)
March 8, 2023, 12:21pm
17
Maybe you are looking for the following:
Thanks, but i still want to have the raw values under this unique column names,
ABC,1
CDE,2
system
(system)
Closed
March 11, 2023, 12:34pm
19
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.