Loading ...
Sorry, an error occurred while loading the content.

Re: [ydn-javascript] Aggregate function on a DataSource

Expand Messages
  • satyam@satyam.com.ar
    The DataSource has two methods which are intended to be overridden, they are doBeforeCallBack and doBeforeParseData. The built-in versions simply return one
    Message 1 of 4 , May 4 5:49 AM
    • 0 Attachment
      The DataSource has two methods which are intended to be overridden, they
      are doBeforeCallBack and doBeforeParseData. The built-in versions simply
      return one of the arguments unaltered. I suggest you use the first one. I
      think that by default it returns the third argument. Whatever it returns,
      that is what the component it is providing data to will receive. You can
      alter that returned value in whichever way you want or extract information
      from it before returning it. Just make sure you do return something and in
      the same basic format. If you put a breakpoint on it and analyze the
      arguments you will soon find what you need.

      I'm sorry I cannot be more explicit because I have just sent my laptop to
      the repair shop and I am with an old machine so I can't find my stuff.

      Satyam




      On Mon, 04 May 2009 07:42:20 -0000, "Tom Praison" <tompraison@...>
      wrote:
      > I am using datasource to fetch remote data to display charts and in
      > datatable. But i need to calculate the average and sum of a particular
      > value in the records in the datasource. Is it possible to do this over
      the
      > datasource?
      >
      >
      >
      > ------------------------------------
      >
      > Yahoo! Groups Links
      >
      >
      >
    • Tom Praison
      Thanks Satyam the reply was very useful indeed and solved many issues..
      Message 2 of 4 , May 4 8:54 PM
      • 0 Attachment
        Thanks Satyam the reply was very useful indeed and solved many issues..

        --- In ydn-javascript@yahoogroups.com, <satyam@...> wrote:
        >
        >
        > The DataSource has two methods which are intended to be overridden, they
        > are doBeforeCallBack and doBeforeParseData. The built-in versions simply
        > return one of the arguments unaltered. I suggest you use the first one. I
        > think that by default it returns the third argument. Whatever it returns,
        > that is what the component it is providing data to will receive. You can
        > alter that returned value in whichever way you want or extract information
        > from it before returning it. Just make sure you do return something and in
        > the same basic format. If you put a breakpoint on it and analyze the
        > arguments you will soon find what you need.
        >
        > I'm sorry I cannot be more explicit because I have just sent my laptop to
        > the repair shop and I am with an old machine so I can't find my stuff.
        >
        > Satyam
        >
        >
        >
        >
        > On Mon, 04 May 2009 07:42:20 -0000, "Tom Praison" <tompraison@...>
        > wrote:
        > > I am using datasource to fetch remote data to display charts and in
        > > datatable. But i need to calculate the average and sum of a particular
        > > value in the records in the datasource. Is it possible to do this over
        > the
        > > datasource?
        > >
        > >
        > >
        > > ------------------------------------
        > >
        > > Yahoo! Groups Links
        > >
        > >
        > >
        >
      • Andy Stevens
        Hi Tom, Slow reply, so it s probably too late anyway, however... Another approach that I ve used on occasion has two datasources. The first datasource is
        Message 3 of 4 , May 13 7:12 AM
        • 0 Attachment
          Hi Tom,

          Slow reply, so it's probably too late anyway, however...

          Another approach that I've used on occasion has two datasources. The
          first datasource is TYPE_HTMLTABLE (there was an existing table in the
          page that I needed to summarise). I call sendRequest myself, and in
          the success function I build up an array of javascript objects (one
          for each group) that store the group key, aggregated total, and a
          nested array of the datarows that contributed to it. The second
          datasource has TYPE_JSARRAY and is based on that array; I use that
          datasource as the source for my datatable (which replaces the original
          table in the page). And because each row in that set had a field
          containing the related original rows, I was able to use that to
          display a second datatable (or might have been a popup panel, can't
          exactly remember) with a detailed breakdown for the selected group as
          the row selection changed.

          Probably I could have reworked it to combine everything in
          doBeforeCallBack (even including the related breakdown row array), but
          this way seemed easier to understand for those who might have to
          maintain it later ;-)


          Andy

          2009/5/5 Tom Praison <tompraison@...>:
          > Thanks Satyam the reply was very useful indeed and solved many issues..
          >
          > --- In ydn-javascript@yahoogroups.com, <satyam@...> wrote:
          >>
          >>
          >> The DataSource has two methods which are intended to be overridden, they
          >> are doBeforeCallBack and doBeforeParseData.  The built-in versions simply
          >> return one of the arguments unaltered.  I suggest you use the first one.  I
          >> think that by default it returns the third argument.  Whatever it returns,
          >> that is what the component it is providing data to will receive. You can
          >> alter that returned value in whichever way you want or extract information
          >> from it before returning it. Just make sure you do return something and in
          >> the same basic format.  If you put a breakpoint on it and analyze the
          >> arguments you will soon find what you need.
          >>
          >> I'm sorry I cannot be more explicit because I have just sent my laptop to
          >> the repair shop and I am with an old machine so I can't find my stuff.
          >>
          >> Satyam
          >>
          >>
          >>
          >>
          >> On Mon, 04 May 2009 07:42:20 -0000, "Tom Praison" <tompraison@...>
          >> wrote:
          >> > I am using datasource to fetch remote data to display charts and in
          >> > datatable. But i need to calculate the average and sum of a particular
          >> > value in the records in the datasource. Is it possible to do this over
          >> the
          >> > datasource?
        Your message has been successfully submitted and would be delivered to recipients shortly.