0 Replies Latest reply on Aug 11, 2011 3:02 AM by Venkatesan Balasubramanian

    while i am trying to save the existing record with same fields in cloud DTO using flex4 mxml app

    Venkatesan Balasubramanian Level 1

      hi,

       

      i am doing flex4 web application with mxml tags,

       

      i  am having one text box and one datagrid and one save button. text box  having one company name, data grid having employee names.

       

      when i click save button which is placed in outside the datagrid it will save all the details in cloud DTO.

       

       

      Now  my requirement is text box having the same company name and when i  enter same employee name in datagrid and click save button means it wont

      allow to save that record, and through msg box with some alerts.

       

      this is my 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).employee name==customerdet.selectedItem.employeename)&&
                            (model.employeeDetailsReqRecordsList.getItemAt(lengthindex).employeeNumber==customerdet.s electedItem.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

       

       

      please help .

      any suggession or snippet code welcome

       

       

      B.venkatesan