Page 1 of 1

Custom aggregate operator

Posted: Thu Feb 16, 2017 4:54 pm
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.


Re: Custom aggregate operator

Posted: Thu Feb 16, 2017 6:35 pm
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.


Re: Custom aggregate operator

Posted: Fri Feb 17, 2017 1:17 pm
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.


Re: Custom aggregate operator

Posted: Fri Feb 17, 2017 4:56 pm
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.


Re: Custom aggregate operator

Posted: Fri Feb 17, 2017 8:09 pm
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.