0 Replies Latest reply on Aug 12, 2011 5:54 AM by Venkatesan Balasubramanian

    how to avoid  specified is out of bounds error in flex 4 mxml web application

    Venkatesan Balasubramanian Level 1

      how to avoid  specified is out of bounds error in flex 4 mxml web application

      hi raghs,

       

       

      i  want to add records in cloud.bt while adding the records if we enter  existing record details and try to save again na it wont allow to that  record.

       

      that time the alert box  should show this msg "This record is already existing record in cloud database.

       

      ex:  one company name called mobile. i am adding a employee name called raja  now i save this record,its data saved in     cloud DTO

        again try to add same employee name raja under the same compny means it should through error.

       

      I am give my code here please if any suggession tel.


      CODE:

       

      private function saveRecord():void
              {
                  refreshRecords();
                  model.employeeDetailsReq=new EMPLOYEEDETAILS_DTO();
                  {
                      var lengthindex:uint=model.employeeDetailsReqRecordsList.length;
                      var i:int;
                      for (i = 0; i < lengthindex; i++)
                      {
                      if((model.employeeDetailsReqRecordsList.getItemAt(lengthindex).employ ee name==customerdet.selectedItem.employeename)&&
                            (model.employeeDetailsReqRecordsList.getItemAt(lengthindex).employeeN    umber==customerdet.selectedItem.employeeID)){
                          Alert.show("you cannot Add Same CustomerName and Invoiceno again");

      (when this line come the error through like this: Index '8' specified is out of bounds.
                     

                      }

      else

      {

       

      var dp:Object=employeedet.dataProvider;           

      var cursor:IViewCursor=dp.createCursor();
      var employeename:String = employeename.text;


               model.employeeDetailsReq.employename = employeename;

      model.employeeDetailsReq.employeeNumber=cursor.current.employeeID;

      var sendRecordToLocID:QuickBaseEventStoreRecord = new
                          QuickBaseEventStoreRecord(model.employeeDetailsReq, new
                              KingussieEventCallBack(refreshList))
                      sendRecordToLocID.dispatch();

      }

       

      <mx:Button   id="btnAdd" x="33" y="419" enabled="false" label="Add" width="65"   fontFamily="Georgia" fontSize="12" click="saveRecord()"/>


      employeename and employeeID are datafields of datagrid. datagrid id=customerdet

       

      employeeDetailsReqRecordsList---recordlist of save records

       

      Thanks,

       

      B.venkatesan