1 Reply Latest reply on May 30, 2010 11:46 PM by nishadmusthafa

    can you add an item to a value object??? Error: 1069

    cyber0897 Level 1

      hey guys... so i have a webservice which returns me ome datatypes called tagInfo, i was wondering if there is a way i can create a new property to a value object??

       

      ive tried something like

       

              var obj:Object = new Object();
              obj.approved = false;
              tagArr[i].addItem(obj);
              displayTagArr.addItem(tagArr[i]);

       

       

      and it gives me an error on the line "tagArr[i].addItem(obj);"

       

      the error states

       

      Error #1069: Property addItem not found on valueObjects.TagInfo and there is no default value.

       

      thanks

        • 1. Re: can you add an item to a value object??? Error: 1069
          nishadmusthafa

          Hi,

           

          I presume you would like to add your own property to the object. In DCD, if you look at the generated valueobjects under the package named valueObjects, you will see for each entity, a set of three classes

           

          for your example it will be

          1 . _tagInfo_typeEntityMetadata

          2 . _Super_tagInfo_type

          3.  tagInfo_type

           

          1 & 2 are regenerated from time to time. So hence do not make any changes to it. By default you cannot dynamically add properties to any class(except of type Object). The way to achieve this functionality is by adding the dynamic keyword like this

           

          public dynamic class tagInfo_type extends _Super_tagInfo_type

           

          Now, For how to add the property, all you need to do is this,

           

          tagInfo_type.approved = false;

           

          The addItem function is used to add a value to a collection. It cannot be used to add properties.

          Hope this helps.

           

          Nishad