Custom aggregate operator

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
andrea.delsole
User
Posts: 3

Custom aggregate operator

Post by andrea.delsole »

Hi everyone.

I have a VIEW with fields as follow:

  • ID_MEZZO NUMBER(22)
  • KM NUMBER (22)
  • QUANTITA NUMBER(22)
  • DATE_ER DATE

I need to create a view that has, within a certain DATA_ER range:

  • an aggregate operator in KM which returns the difference between the last and the first KM value grouped by ID_MEZZO;
  • aggregate operator with the sum of the values in the QUANTITA field, grouped by ID_MEZZO.

What is the best approach to make a custom aggregate operator such as this?

I’ve tried with several views, but I encountered difficulties because I need to filter items before doing the actual view.
I’ve tried with a STORED PROCEDURE approach, but I’d like to avoid them.
I’ve tried building a custom page, but I don’t know how to dynamically add columns and values.
I’m trying using jQuery on the view above. This could work, but doesn’t seem to be the best “phpmakerish” approach.

Is there a way to customize the default phpmaker aggregate function?

Regards.


mobhar
User
Posts: 11703

Post by mobhar »

andrea.delsole wrote:
I’ve tried with several views, but I encountered difficulties because I need to filter
items before doing the actual view.

You may simply use "Recordset_Selecting" server event if you want to impelement your own custom filter before displaying the List Page. Please read "Server Events and Client Scripts" topic from PHPMaker Help menu for more info and example.


arbei
User
Posts: 9360

Post by arbei »

  • an aggregate operator in KM which returns the difference between the last and the first KM value grouped by ID_MEZZO;
  • aggregate operator with the sum of the values in the QUANTITA field, grouped by ID_MEZZO.

Have you try to display your data in Report?
Read help file topic: "Project Setup" -> "Using Report" for more information.


andrea.delsole
User
Posts: 3

Post by andrea.delsole »

I tried making a Report file.
I've encountered an error:

"PHP Fatal error: Call to a member function RecordCount() on boolean in C:\ICMEI_HOME\lcmei\EROGAZIONIreport.php on line 1332"

In this report file I have ID_MEZZO as grouping levels and DATA_ER as sort order. I didn't set a summary values yet.
What's the problem?

Regards.


andrea.delsole
User
Posts: 3

Post by andrea.delsole »

arbei wrote:

  • an aggregate operator in KM which returns the difference between the last
    and the first KM value grouped by ID_MEZZO;
  • aggregate operator with the sum of the values in the QUANTITA field,
    grouped by ID_MEZZO.

Have you try to display your data in Report?
Read help file topic: "Project Setup" -> "Using Report" for
more information.

I tried making a Report file.
I've encountered an error:

"PHP Fatal error: Call to a member function RecordCount() on boolean in C:\ICMEI_HOME\lcmei\EROGAZIONIreport.php on line 1332"

In this report file I have ID_MEZZO as grouping levels and DATA_ER as sort order. I didn't set a summary values yet.
What's the problem?

Regards.


Post Reply