Subject Re: REPORT GROUPING ON FIELDS
From Akshat Kapoor <akshat.kapoor@kapoorsons.in>
Date Fri, 23 Jun 2017 00:37:54 +0530
Newsgroups dbase.getting-started
Attachment(s) inve.dmd

On 22/06/2017 18:32, Mustansir Ghor wrote:
> Dear all
>
> how Can we make grouping on calculated fields in reports.
>
> Example we want to create a new stream frame  as group for Customer listing based on the first character of Name. eg group based on LEFT(name,1)
>
> Regards
> Mustansir
>
Hello Mustansir,
The method I am about to outline is slightly out of the box.

Design a datamodule for the rowset you are using in the report.
In the data module add a calculated field to the rowset.

When you use this data module in your report this calculated field  is
available for data grouping just like any of the other normal fields of
the table.

I am still not very fluent in designing reports hence unable to send you
a sample report.

But attaching a datamodule.

With small changes in sql and field names this should work for you or
you can design a data module.

Instructions for adding a calculated field are also there in Ken's book.
(If you have a pdf then go to page no. 182 or if hard copy then go to
page 162 volume 1 )

Hope you are able to understand my out of the box thinking.
Regards
Akshat



** END HEADER -- do not remove this line
//
// Generated on 25.02.2017
//
class inveDATAMODULE of DATAMODULE
   this.INVE = new QUERY(this)
   with (this.INVE)
      onOpen = class::INVE_ONOPEN
      left = 291.0
      top = 22.0
      sql = 'Select * from "inve16.dbf"'
      active = true
   endwith

   with (this.INVE.rowset)
      with (fields["full"])
         beforeGetValue = {||iif(this.parent["company"].value#null ,left(this.parent["company"].value,1),"1")}
      endwith
      autoNullFields = false
   endwith

        function inve_onOpen()
                g = new field()
                g.fieldname = "full"
                this.rowset.fields.add(g)
                g.beforegetvalue = {||iif(this.parent["company"].value#null ,left(this.parent["company"].value,1),"1")}
                        
      return

endclass