raajeshnrh
Member
- Joined
- Feb 13, 2022
- Messages
- 10
- Programming Experience
- Beginner
Team, I'm facing a typical issue in data transformation in C#, I'm having the below list
My expected result output should be as below that I want to combine the similar Country Like Germany (2nd row) to 1st row as
in my application Stored Procedure may return more than 1 countries at a time like Denmary would come 2 times, India would come 2 times
I want to group the countries and make them in a single row itself.
Your help would be appreciated.
Thanks
C#:
+---------+---------------+----------+-----------+-----------+
| Country | BillingMethod | InvCount | CustCount | InvAmount |
+---------+---------------+----------+-----------+-----------+
| Germany | Paper | 4 | 5 | 1234 |
| Germany | eInvoice | 52 | 34 | 4567 |
| Greece | Paper | 8 | 75 | 78955 |
| Denmark | Paper | 32 | 15 | 7890 |
| Norway | eInvoice | 4 | 52 | 65898 |
+---------+---------------+----------+-----------+-----------+
C#:
+---------+---------+----------+-------------+--------------+-------------+----------------+-------------+--------+
| Country | BMPaper | BMInv | InvCntPaper | CustCntPaper | InvAmtPaper | InvCnteInvoice | CustCnteInv | InvAmt |
+---------+---------+----------+-------------+--------------+-------------+----------------+-------------+--------+
| Germany | Paper | eInvoice | 4 | 5 | 1234 | 52 | 34 | 4567 |
| Greece | Paper | Null | 8 | 75 | 78955 | 0 | 0 | 0 |
| Denmark | Paper | Null | 32 | 15 | 7890 | 0 | 0 | 0 |
| Norway | Null | eInvoice | 0 | 0 | 0 | 4 | 52 | 65898 |
+---------+---------+----------+-------------+--------------+-------------+----------------+-------------+--------+
I want to group the countries and make them in a single row itself.
Your help would be appreciated.
Thanks
Last edited by a moderator: