# class hk_reportsection

represents a section of the report. More...

Definition | `#include <hk_classes/hk_classes/hk_reportsection.h>`
Inherits | hk_dsdatavisible [public ]
List of all Methods

Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- void set_unique (bool unique=true, bool endsection=false,bool registerchange=true)
- bool unique (void)
- hk_reportdata* new_data (void)
- hk_reportdata* data_at (unsigned int)
- vector<hk_reportdata*>* datalist (void)
- virtual void actual_string (void)
- hk_string sectionbegin (void)
- void set_sectionbegin (const hk_string& b,bool registerchange=true)
- hk_string sectionend (void)
- void set_sectionend (const hk_string& e,bool registerchange=true)
- hk_string betweendata (void)
- void set_betweendata (const hk_string& b,bool registerchange=true)
- bool new_uniquevalue (bool justcheck=false)
- bool endsection (void)
- void set_automatic_create_data (bool d=true,bool registerchange=true)
- bool new_page_after_section (void)
- void set_new_page_after_section (bool p,bool registerchange=true)
- bool section_was_printed (void)
- void set_subreport (const hk_string& subreport="",bool before_data=false,bool registerchange=true)
- hk_string subreportname (void)
- hk_report* subreport (void)
- void add_depending_fields (const hk_string& thisreport_field, const hk_string& subreport_field,bool registerchange=true)
- void clear_depending_fields (void)
- list<hk_string>* depending_on_thisreportfields (void)
- list<hk_string>* depending_on_subreportfields (void)
- bool print_subreport_before_data (void)
- void print_subreport (void)
- void set_replacefunction (const hk_string& f,bool registerchange=true)
- virtual hk_string replace (const hk_string& where)
- void reset_count (void)
- virtual hk_font font (void)
- virtual unsigned long counts_as (void)
- void set_sectioncountfunction (const hk_string& f,bool registerchange=true)
- hk_string sectioncountfunctionstring (void)
- reportsectioncounttype* sectioncountfunction (void)
- virtual void savedata (ostream& s,bool userdefined=false)
- virtual void loaddata (const hk_string& definition,bool userdefined=false)
- virtual void set_datasource (hk_datasource* d)
- virtual bool set_presentationdatasource (long n, bool registerchange=true)
- hk_string default_reportdata (void)
- void set_default_reportdata (const hk_string& v,bool registerchange=true)
- hk_string default_beforereportdata (void)
- void set_default_beforereportdata (const hk_string& v,bool registerchange=true)
- hk_string default_afterreportdata (void)
- void set_default_afterreportdata (const hk_string& v,bool registerchange=true)
- void set_default_reportdataconfigurefunction (const hk_string& f,bool registerchange=true)
- hk_string default_reportdataconfigurefunction (void)
- int default_reportprecision (void)
- void set_default_reportprecision (int, bool registerchange=true)
- bool default_use_reportseparator (void)
- void set_default_use_reportseparator (bool, bool registerchange=true)
- void neutralize_definition (bool registerchange)
- virtual void reset (void)
- void clear_countingfields (void)
- void remove_data (hk_reportdata*)
- hk_report* report (void)
- unsigned int horizontal2relativ (unsigned int h)
- unsigned int vertical2relativ (unsigned int v)
- unsigned int relativ2horizontal (unsigned int r)
- unsigned int relativ2vertical (unsigned int r)
- hk_reportsectionpair* reportsectionpair (void)
- bool set_offset (unsigned int o,bool registerchange=true)
- unsigned int offset (void)
- void bulk_operation (hk_presentation::enum_bulkoperation bulkoperation)
- void set_automaticcreatedatafunction (reportsectionautomaticcreatedatatype*)
- reportsectionautomaticcreatedatatype* automaticcreatedatafunction (void)
- hk_reportdata* get_reportdatavisible (long nr)
- hk_reportdata* get_reportdatavisible (const hk_string& identifier)

#### Public Static Methods

- static void add_sectionreplacefunctiontype (const hk_string& name,section_replacefunctiontype* f)
- static list<hk_string>* sectionreplacefunctionlist (void)
- static void add_sectioncountfunctiontype (const hk_string& name,reportsectioncounttype* f)
- static list<hk_string>* sectioncountfunctionlist (void)

#### Protected Methods

- hk_reportsection (hk_report*)
- virtual ~hk_reportsection (void)
- virtual void before_datasource_enables (void)
- void remove_all_datas (void)
- virtual hk_reportdata* widget_specific_new_data (void)
- virtual void widget_specific_after_loaddata (void)
- virtual void widget_specific_offset_changed (void)
- virtual void sizetype_changed (void)
- virtual void presentationmode_changed (void)
- void automatic_create_datafields (void)
- void force_new_section (void)
- void raise_widget (hk_reportdata*)
- void lower_widget (hk_reportdata*)

#### Protected Members

- bool p_already_automaticcreated_data
- vector<hk_reportdata*> p_data
- bool p_unique
- hk_string p_lastuniquevalue
- hk_string p_sectionbegin
- hk_string p_sectionend
- hk_string p_betweendata
- hk_report* p_report
- hk_report* p_subreport
- hk_string p_subreportstring
- bool p_print_subreport_before_data
- bool p_uniqueendsection
- bool p_automatic_create_datas
- bool p_newpageaftersection
- bool p_sectionwasprinted
- section_replacefunctiontype* p_replacefunction
- hk_string p_replacefunctionstring
- hk_string p_default_data
- hk_string p_default_beforedata
- hk_string p_default_afterdata
- hk_string p_default_dataconfigurefunction
- int p_default_precision
- bool p_default_use_thousandsseparator
- unsigned int p_offset

## Detailed Description

hk_reportsection represents a section in a hk_report element. Within a section you can define the outputdata,use it as headers for your data and so in If it is needed as a section header or footer use set_unique in combination with set_uniquecolumn It also can contain subreports. Usually section come as "twins", a header section and a footer section belonging to each other, see hk_reportsectionpair for details

    Example: Defining a CVS output (no first row with columnnames)
     //
     // first define a datasource
     //
    hk_drivermanager p_driver;
    hk_connection* connect=p_driver.new_connection("mysql");
    connect->set_user("root");
    connect->set_host("localhost");
    connect->set_password("my_password");
    connect->connect();
    hk_database* database=connect->new_database("vokabeltrainer");
     //
     //now start defining the report
     //
    hk_report e;
     long int datasrc =e.new_datasource("reportabfrage",true);//loads an existing query
     e.set_presentationdatasource(datasrc);
    hk_reportsection* s=e.datasection();
    s->set_default_data("\"%VALUE%\""); // define " before and after the value of a column
    s->set_betweendata(" , "); // a comma separated list
    s->set_sectionend("\n"); // one row per datarow
    e.execute();

you can use the variables

    %PAGENUMBER%         the number of the page
    %ABSOLUTEPAGENUMBER% physical number of the page in file

void set_unique (bool unique=true, bool endsection=false,bool registerchange=true)

### set_unique

If the section should be printed just once per block and not for each datarow use this function

Parameters:

unique | true if this section should be printed once interesting four grouped data
endsection | true if this section should not be printed as a header. Instead it will be printed at the end of the block. Sections created with hk_reportsectionpair are already set correctly.

bool unique (void)

### unique

hk_reportdata* new_data (void)

### new_data

the printed data. See hk_reportdata and default_data for details

hk_reportdata* data_at (unsigned int)

### data_at

vector<hk_reportdata*>* datalist (void)

### datalist

void actual_string (void)

### actual_string

[virtual]

will send the actual data to the outputstream hk_report::outputstream

hk_string sectionbegin (void)

### sectionbegin

The sectionbegin will be printed as a header of the section (before the data)

void set_sectionbegin (const hk_string& b,bool registerchange=true)

### set_sectionbegin

hk_string sectionend (void)

### sectionend

The sectionend will be printed as a footer of the section (after the data) i.e. a \n at the end of a datarow

void set_sectionend (const hk_string& e,bool registerchange=true)

### set_sectionend

hk_string betweendata (void)

### betweendata

A string that will be printed between two datasegments defined with new_data i.e. If you want a comma separated list you would need set_betweendata(" , ");

void set_betweendata (const hk_string& b,bool registerchange=true)

### set_betweendata

bool new_uniquevalue (bool justcheck=false)

### new_uniquevalue

Parameters:

justcheck | if true no variables(lastvalue) will be changed

Returns: true if this section is a unique section and this section has to be printed

bool endsection (void)

### endsection

Returns: true if this section is a unique section and will be printed behind the data

void set_automatic_create_data (bool d=true,bool registerchange=true)

### set_automatic_create_data

If set true and you haven't defined any data with new_data it will automatically create the data set with default_data

bool new_page_after_section (void)

### new_page_after_section

true if a new page will be started after printing this section. Usually this function should only be used in combination with set_unique as an endsection

void set_new_page_after_section (bool p,bool registerchange=true)

### set_new_page_after_section

bool section_was_printed (void)

### section_was_printed

Returns: true if this section has been printed (unique sections will not be printed for every row) else false

void set_subreport (const hk_string& subreport="",bool before_data=false,bool registerchange=true)

### set_subreport

A complete other report can be printed within a section

Parameters:

subreport | the subreport
before_data | if true the subreport will be printed before the data of this section will be printed, else it will be printed after the data

hk_string subreportname (void)

### subreportname

hk_report* subreport (void)

### subreport

void add_depending_fields (const hk_string& thisreport_field, const hk_string& subreport_field,bool registerchange=true)

### add_depending_fields

If you set a subreport with set_subreport add the fields which are connected between the reports

void clear_depending_fields (void)

### clear_depending_fields

list<hk_string>* depending_on_thisreportfields (void)

### depending_on_thisreportfields

list<hk_string>* depending_on_subreportfields (void)

### depending_on_subreportfields

bool print_subreport_before_data (void)

### print_subreport_before_data

void print_subreport (void)

### print_subreport

void set_replacefunction (const hk_string& f,bool registerchange=true)

### set_replacefunction

You can enhance the possibilities of the section by writing your own function.This function could for example handle your own variables.

hk_string replace (const hk_string& where)

### replace

[virtual]

Reimplemented from hk_visible.

void add_sectionreplacefunctiontype (const hk_string& name,section_replacefunctiontype* f)

### add_sectionreplacefunctiontype

[static]

list<hk_string>* sectionreplacefunctionlist (void)

### sectionreplacefunctionlist

[static]

void reset_count (void)

### reset_count

Will set all COUNT, SUM, AVERAGE and so on variables to 0, if they are not "running counts" (which mean global for the whole report).See hk_reportdata for details. Usually you dont't have to call this function

hk_font font (void)

### font

[virtual]

Reimplemented from hk_visible.

unsigned long counts_as (void)

### counts_as

[virtual]

Reimplemented from hk_visible.

void add_sectioncountfunctiontype (const hk_string& name,reportsectioncounttype* f)

### add_sectioncountfunctiontype

[static]

needed by hk_report::set_periodic. It is possible to compute as how much a section counts.

Parameters:

f | is a userdefined function that will be called whenever counts_as is called.

list<hk_string>* sectioncountfunctionlist (void)

### sectioncountfunctionlist

[static]

void set_sectioncountfunction (const hk_string& f,bool registerchange=true)

### set_sectioncountfunction

hk_string sectioncountfunctionstring (void)

### sectioncountfunctionstring

reportsectioncounttype* sectioncountfunction (void)

### sectioncountfunction

void savedata (ostream& s,bool userdefined=false)

### savedata

[virtual]

Reimplemented from hk_dsdatavisible.

void loaddata (const hk_string& definition,bool userdefined=false)

### loaddata

[virtual]

Reimplemented from hk_dsdatavisible.

void set_datasource (hk_datasource* d)

### set_datasource

[virtual]

Reimplemented from hk_dsdatavisible.

bool set_presentationdatasource (long n, bool registerchange=true)

### set_presentationdatasource

[virtual]

Reimplemented from hk_dsvisible.

hk_string default_reportdata (void)

### default_reportdata

the default column value will be used as a default when a new data will be created with new_data default is @VALUE@

void set_default_reportdata (const hk_string& v,bool registerchange=true)

### set_default_reportdata

hk_string default_beforereportdata (void)

### default_beforereportdata

void set_default_beforereportdata (const hk_string& v,bool registerchange=true)

### set_default_beforereportdata

hk_string default_afterreportdata (void)

### default_afterreportdata

void set_default_afterreportdata (const hk_string& v,bool registerchange=true)

### set_default_afterreportdata

void set_default_reportdataconfigurefunction (const hk_string& f,bool registerchange=true)

### set_default_reportdataconfigurefunction

hk_string default_reportdataconfigurefunction (void)

### default_reportdataconfigurefunction

int default_reportprecision (void)

### default_reportprecision

void set_default_reportprecision (int, bool registerchange=true)

### set_default_reportprecision

bool default_use_reportseparator (void)

### default_use_reportseparator

void set_default_use_reportseparator (bool, bool registerchange=true)

### set_default_use_reportseparator

void neutralize_definition (bool registerchange)

### neutralize_definition

void reset (void)

### reset

[virtual]

void clear_countingfields (void)

### clear_countingfields

void remove_data (hk_reportdata*)

### remove_data

hk_report* report (void)

### report

unsigned int horizontal2relativ (unsigned int h)

### horizontal2relativ

100% is report width - left border - right border

unsigned int vertical2relativ (unsigned int v)

### vertical2relativ

100% is report height - top border - bottom border

unsigned int relativ2horizontal (unsigned int r)

### relativ2horizontal

100% is report width - left border - right border

unsigned int relativ2vertical (unsigned int r)

### relativ2vertical

100% is report height - top border - bottom border

hk_reportsectionpair* reportsectionpair (void)

### reportsectionpair

bool set_offset (unsigned int o,bool registerchange=true)

### set_offset

The offset is additional space at the end of the section (totalsectionsize= size needed by reportdata + offset)

unsigned int offset (void)

### offset

void bulk_operation (hk_presentation::enum_bulkoperation bulkoperation)

### bulk_operation

void set_automaticcreatedatafunction (reportsectionautomaticcreatedatatype*)

### set_automaticcreatedatafunction

reportsectionautomaticcreatedatatype* automaticcreatedatafunction (void)

### automaticcreatedatafunction

hk_reportdata* get_reportdatavisible (long nr)

### get_reportdatavisible

hk_reportdata* get_reportdatavisible (const hk_string& identifier)

### get_reportdatavisible

hk_reportsection (hk_report*)

### hk_reportsection

[protected]

~hk_reportsection (void)

### ~hk_reportsection

[protected virtual]

void before_datasource_enables (void)

### before_datasource_enables

[protected virtual]

Reimplemented from hk_dsvisible.

void remove_all_datas (void)

### remove_all_datas

[protected]

hk_reportdata* widget_specific_new_data (void)

### widget_specific_new_data

[protected virtual]

void widget_specific_after_loaddata (void)

### widget_specific_after_loaddata

[protected virtual]

void widget_specific_offset_changed (void)

### widget_specific_offset_changed

[protected virtual]

void sizetype_changed (void)

### sizetype_changed

[protected virtual]

Reimplemented from hk_visible.

void presentationmode_changed (void)

### presentationmode_changed

[protected virtual]

Reimplemented from hk_dsvisible.

void automatic_create_datafields (void)

### automatic_create_datafields

[protected]

void force_new_section (void)

### force_new_section

[protected]

bool p_already_automaticcreated_data

### p_already_automaticcreated_data

[protected]

vector<hk_reportdata*> p_data

### p_data

[protected]

bool p_unique

### p_unique

[protected]

hk_string p_lastuniquevalue

### p_lastuniquevalue

[protected]

hk_string p_sectionbegin

### p_sectionbegin

[protected]

hk_string p_sectionend

### p_sectionend

[protected]

hk_string p_betweendata

### p_betweendata

[protected]

hk_report* p_report

### p_report

[protected]

hk_report* p_subreport

### p_subreport

[protected]

hk_string p_subreportstring

### p_subreportstring

[protected]

bool p_print_subreport_before_data

### p_print_subreport_before_data

[protected]

bool p_uniqueendsection

### p_uniqueendsection

[protected]

bool p_automatic_create_datas

### p_automatic_create_datas

[protected]

bool p_newpageaftersection

### p_newpageaftersection

[protected]

bool p_sectionwasprinted

### p_sectionwasprinted

[protected]

section_replacefunctiontype* p_replacefunction

### p_replacefunction

[protected]

hk_string p_replacefunctionstring

### p_replacefunctionstring

[protected]

hk_string p_default_data

### p_default_data

[protected]

hk_string p_default_beforedata

### p_default_beforedata

[protected]

hk_string p_default_afterdata

### p_default_afterdata

[protected]

hk_string p_default_dataconfigurefunction

### p_default_dataconfigurefunction

[protected]

int p_default_precision

### p_default_precision

[protected]

bool p_default_use_thousandsseparator

### p_default_use_thousandsseparator

[protected]

unsigned int p_offset

### p_offset

[protected]

void raise_widget (hk_reportdata*)

### raise_widget

[protected]

Reimplemented from hk_visible.

void lower_widget (hk_reportdata*)

### lower_widget

[protected]

Reimplemented from hk_visible.

- Version: $Revision: 1.40 $
- Author: Horst Knorr (hk_classes@knoda.org)
- Generated: horst on horstnotebook on Tue Mar 30 19:06:43 2004, using kdoc 2.0a54.