2 Replies Latest reply on Mar 28, 2010 9:24 AM by kubens

    Getting table row count through amf.

    Aron manager Level 1

      Hi!,

       

      Sorry if this is a so basic question but I have found something I can not solve in a clean way. I need the total row count for a table, if I return the count after an amf (GetRowCount) call it will produce an error because amf works with objects and don't really know how to deserialize just an int (or am I wrong?). So, what's the best way to do it? I have thought about creating a new Remote Object called CountRO but this seems pretty overkill to just return the number of rows of a table. Is there a better solution?.

       

      Thanks in advance,

      Aron.

        • 1. Re: Getting table row count through amf.
          Aron manager Level 1

          Hi,

           

          Could anyone please give any tip on this? I would really apreciate it.

           

          Thanks in advance,

          Aron.

          • 2. Re: Getting table row count through amf.
            kubens Level 2

            I have not an example with amf, currently I am using just a simple HTTPService which handles xml. In this case my requested services provides following xml back:

             

            <data>
                 <action>list</action>
                 <total>12</total>
                 <items>

                      <item>Lorem Apsum</item>

                      <item>Lorem Epsum</item>

                      <item>Lorem Ipsum</item>

                      <item>Lorem Opsum</item>

                 </items>

            </data>

             

            Inside the successEvent I extract this total information from the xml:

             

                 var xml:XML = new XML(event.message.body.toString());

                 var _total:Number = xml.elements('total')[0] || 0;

             

            You will find an example of that on my current playground.

             

            I assum that it will be similar with amf.

             

            Wolfgang

            1 person found this helpful