MarshallRichard
New member
- Joined
- May 13, 2013
- Messages
- 2
- Programming Experience
- 10+
What i am trying to do is to compair two data objects (_itemSupplier & _item) and depending on if the id's match, write data from one of the two data objects into a third data object (_results) to use for a datasource. I'm drawing a complete blank on how to get this accomplish.
My two data models are like the following;
My variables are like the following;
The variables are filled with data like;
Some pseudo-code that i wrote up;
deserved output would looks something like this;
Item Name | Supplier Name
--------------------------------------
paper | <nothing>
pen | office depot
My two data models are like the following;
VB.NET:
Public Class ItemSupplier
Public Property ItemId as Integer
Public Property ItemName as String
Public Property SupplierId as Integer
Public Property SupplierName as String
End Class
Public Class Item
Public Property ItemId as Integer
Public Property itemName as String
End Class
My variables are like the following;
VB.NET:
Dim _itemSupplier as list(of ItemSupplier) = <fill list with data>
Dim _item as list(of Item) = <fill list with data>
Dim _results as list(of itemSupplier) = nothing
The variables are filled with data like;
VB.NET:
_itemSupplier.index(0) contains = 1,"paper",1,"office depot"
_item.index(0) contains 1,"paper"
_item.index(1) contains 2,"pen"
Some pseudo-code that i wrote up;
VB.NET:
For Each i in Item
If _itemSupplier.ItemId = _item.ItemId then
_results.itemId = _itemSupplier.itemId
_results.itemName = _itemSuppler.itemName
_results.SupplierId = _itemSupplier.SupplierId
_results.SupplierName = _itemSupplier.SupplierName
Else
_results.itemId = _item.ItemId
_results.itemName = _item.ItemName
_results.SupplierId = Nothing
_results.SupplierName = nothing
End if
Next
deserved output would looks something like this;
Item Name | Supplier Name
--------------------------------------
paper | <nothing>
pen | office depot