sendow 11/14/2008 1:24:46 PM

eConnect: Assigning Multiple Item Sites to an Item

I believe that this applies to any eConnect object that can have multiple 'child' objects (i.e. Customer addresses, Vendor addresses), but in my case I happen to need it for Items with multiple ItemSites.  Every example of this that I have seen only has 1 child object, so I haven't found any examples of how to do this properly. 

So I have a simple array that contains the list of sites, and every item needs to be assigned to those sites.  I then read that array, set the properties of the ItemSite object, and then attempt to assign that ItemSite to my ItemSites array. 

 

Dim ItemSite As New taItemSite_ItemsTaItemSite
Dim ItemSites() As taItemSite_ItemsTaItemSite
Dim siteLoop As Integer = 0
For siteLoop = 0 To UBound(itemSitesArray)
    ItemSite.ITEMNMBR = Item.ITEMNMBR
    ItemSite.LOCNCODE = itemSitesArray(siteLoop)

    ReDim Preserve ItemSites(siteLoop)
    ItemSites(siteLoop) = ItemSite
Next

 

This code compiles and runs, but the problem I'm having is that the assignment line (last line in the loop) is assinging a pointer/reference to the ItemSite object, and is not assigning a copy of the ItemSite object.  So after ItemSites(0) = ItemSite, and ItemSites(1) = ItemSite, when I change the values of ItemSite.ITEMNMBR, it is changing the ITEMNMBR value for ItemSites(0) and ItemSites(1). 

I've looked at DirectCast(), but the taItemSite object doesn't support MemberwiseClone.

Is there a different method for assigning the object?  Or do I have to write a manual 'clone' function like what is discussed here:

http://www.xtremevbtalk.com/showthread.php?t=177296

 

Or should I just write a separate function to independently assign an Item Site to an existing inventory item after it is created and  just call that function multiple times?

 

Version: Unknown or N/A
Section: eConnect


Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3