coder
(coder)
1
Hello,
can anyone help me with this query?
dt.AsEnumerable.GroupBy(Function(r) r("ContractNumber").ToString).Select(Function(g) dtResult.LoadDataRow({g.Key,g.Where(Function(r) r("Status").ToString="Not-Submitted" OrElse r("Status").ToString="Submitted" ).Count,g.Where(Function(r) r("Status").ToString="Submitted").Count,g.Where(Function(r) r("Status").ToString="Not-Submitted").Count, (100*(g.Where(Function(r) r("Status").ToString="Submitted").Count/g.Where(Function(r) r("Status").ToString="Not-Submitted" OrElse r("Status").ToString="Submitted" ).Count)).ToString+"%" },False)).CopyToDataTable
I am trying to add another column name with the **Contract Number**
which is called “Name”
so when it’s written the ContractNumber data, I need it to write the Name also.
The contract number and Name are related to each other.
Thank you
.
Anil_G
(Anil Gorthi)
2
@coder
You can use r("Contractnumber").ToString + r("Name").ToString
Cheers
coder
(coder)
3
Thank you for your reply, but it’s not working.
i didn’t get the result of the name
Anil_G
(Anil Gorthi)
4
@coder
Can you please explain what is not working and what you are getting and what you need
you asked for group by…so you want the data also to be visible in output?
cheers
coder
(coder)
5

this is the output, but I wanted it to be in the Name column.
Anil_G
(Anil Gorthi)
7
@coder
If you need to add it as separate column then try this
dt.AsEnumerable.GroupBy(Function(r) r("ContractNumber").ToString).Select(Function(g) dtResult.LoadDataRow({g.Key,g.First()("Name").ToString,g.Where(Function(r) r("Status").ToString="Not-Submitted" OrElse r("Status").ToString="Submitted").Count,g.Where(Function(r) r("Status").ToString="Submitted").Count,g.Where(Function(r) r("Status").ToString = "Not-Submitted").Count, (100*(g.Where(Function(r) r("Status").ToString="Submitted").Count/g.Where(Function(r) r("Status").ToString = "Not-Submitted" OrElse r("Status").ToString="Submitted" ).Count)).ToString+"%" },False)).CopyToDataTable
cheers
1 Like
coder
(coder)
9
Its working , Thank you for your help
1 Like
system
(system)
Closed
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.