3 Replies Latest reply on Mar 13, 2010 2:26 AM by Radhakrishna Bhat

    bug + workaround on dataservice generate forms

    JohanVelthuis Level 1

      When I generate a form from a dataservice, there is a bug in the callResponder

       

      <s:CallResponder id="getRegBegeleidersByIDResult" result="regBegeleiders = getRegBegeleidersByIDResult.lastResult[0] as RegBegeleiders"/>

       

      The bold part should be removed:

      <s:CallResponder id="getRegBegeleidersByIDResult" result="regBegeleiders = getRegBegeleidersByIDResult.lastResult as RegBegeleiders"/>

       

      Also, when working with the same service for datagrid and form in different components, dont forget to check the Service Manager in Project -> properties ->dataservices

        • 1. Re: bug + workaround on dataservice generate forms
          Radhakrishna Bhat Level 3

          Only when operation's return type is an array, Form Generation generates code which assigns lastResult[0] to result Form. Can you check if getRegBegeleidersByID operation is returning array? Also there was an issue in earlier builds https://bugs.adobe.com/jira/browse/FB-25702 which was settings getItemByID return type as array in sample generation.

           

          -Radhakrishna

          • 2. Re: bug + workaround on dataservice generate forms
            JohanVelthuis Level 1

            Hello Radhakrishna,

             

            Below is the function that is responsible for the returned value.

            As far as I can tell it does not return an array, but a single row (which is an object in my opinion).

            Since the Id column is the primary key, it never returns more than one item.

            The function below is also autogenerated by flash builder 4.

             

            public function getRegBegeleidersByID($itemID) {
                   
                    $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename where Id=?");
                    $this->throwExceptionOnError();
                   
                    mysqli_bind_param($stmt, 'i', $itemID);       
                    $this->throwExceptionOnError();
                   
                    mysqli_stmt_execute($stmt);
                    $this->throwExceptionOnError();
                   
                    mysqli_stmt_bind_result($stmt, $row->Id, $row->Voornaam, $row->tussenVoegsel, $row->Achternaam, $row->Wachtwoord, $row->Geslacht, $row->Adres, $row->Postcode, $row->Woonplaats, $row->TelVast, $row->TelMobiel, $row->Emailadres, $row->Geboortedatum, $row->Laatste_bjaar, $row->Laatste_bjaar2, $row->jarenActief, $row->jarenActief2, $row->Rijbewijs, $row->busBevoegd, $row->Les, $row->Ervaring, $row->Ervaring2, $row->Opleiding, $row->Beroep, $row->Werkervaring, $row->Bijzonderheden, $row->Geschiedenis, $row->Geschiedenis2, $row->sysNew, $row->sysDeleted, $row->sysCreated);
                   
                    if(mysqli_stmt_fetch($stmt)) {
                        return $row;
                    } else {
                        return null;
                    }
                }

            • 3. Re: bug + workaround on dataservice generate forms
              Radhakrishna Bhat Level 3

              Hi,

               

              Actually I meant, in the Data/Services View of Flash Builder, not PHP side. If the returning type of an operation is 'configured' as Array the issue occurs. This is fixed in newer builds as part of https://bugs.adobe.com/jira/browse/FB-25705 . Workaround would be for you to manually change the generated code or set return type to 'non-array' for that operation using Configure Return Type wizard.

               

              -Radhakrishna