I have a table in a datatable type as seen below. In this table, I will make a calculation for purchases for the same material number. I will calculate the difference between the most current international and the most current domestic purchase. I need to pull and process the international and domestic data of the same material number from this table.
As a result, we should have 1 external purchase and 1 internal purchase information for each material number. According to this information, transactions will be made according to the “Amount” and “Currency” information.
For example for material number 1003;
The most up-to-date domestic and international procurement information.
We do have some doubts on the requirement description
Give a try at
dtResult =
(From d in dtData.AsEnumerable()
Group d by k1=d("Place of Purchase").toString.Trim.ToUpper(), k2=d(Material Number").toString.Trim into grp = Group
Let fr = grp.OrderBy(Function (g) CDate(g("Purchase Date").toString.Trim)).Last()
Select r = fr).CopyToDataTable
Thank you, I can use that. Also, for the same process, I don’t want any data to be written to the table for data that does not have overseas data. Is this possible? For example, if there is no overseas information for Material Number 1005, the domestic information should not be in the table.