2 Replies Latest reply on Jul 3, 2012 9:00 AM by JDavi2001

    Array object entry getting updated strangely

    JDavi2001

      Hi,

      I am trying to build a common array of objects. I am taking in data from the screen and adding to an array. Somehow when my temporary object is being built it updates the existing entry in the array so by the end all the entries are identical - not what I wanted. Here is the basic code -   

       

       

       

                                      zoneDetails.zonePlantET = eto;

                                      zoneDetails.zonePlantType = plantType;

                                      zoneDetails.zoneIrrigationEfficiency = ie;

                                      zoneDetails.zoneIrrigationType = irrigationType;

                                   

                                     

                                      zoneDetails.zonePlantWaterReq = waterReq;

                                      zoneTemp[i] = zoneDetails;

       

      OK - edit is not working with me but zoneDetails is a public object and zoneTemp is a public array and I assure you i is incremented each go, but zoneTemp[0] gets updated to the [1] details before the assignment at the end .