Conditional Page Break

edited July 2013 in FastReport 4.0
I have a report with a page break set in the GroupHeader band. Right now it is set to break on data field Encounter.Doctor (table.column name)

There is an option to choose Expression below the Data field option. Can I insert a conditional page break here?
I have a keyvalue from a ComboBox to use in the expression.

I basically need the following IF statement but do not know how to get it into a code that Fast Reports can read. Is there some pascal code or another technique to acheive this?
If :DBLookupComboBox1.keyvalue := 'QQZ' Then break on Encounter.Doctor
Else 
    break on Encounter.Clinic

Comments

  • gpigpi
    edited 1:36PM
    Use Engine.NewPage in report's script
  • gordkgordk St.Catherines On. Canada.
    edited 1:36PM
    David the normal method would be to call engine.newpage in the obp event of the header
  • edited 1:36PM
    Thanks for the suggestions. I'm reading about engine.newpage right now. If I place it in the header, can I make it conditional depending on the value of the combobox? Do I need to store the values of Encounter.Doctor
    and Encounter.Clinic in variables and then call engine.newpage when there is a change? I've done something similar in other languages.

  • edited July 2013
    I have two comboboxes. One is to select a doctor. The other is to select a clinic. If the user selects a doctor and makes no selection in the other combobox, the report lists all clinics for that doctor. If the user selects the clinic and leaves the other combobox unselected, it lists all doctors for that clinic. It is currently set to break on doctor in the GroupHeader under the section where you can choose datafield or expression. I'll reword my question above. Is there a way to choose the datafield to break on depending on the value in a combobox? Or, will I have to write code to keep track of the values printed and then call engine.newpage when there is a change in value? (that would be clinic or doctor depending on the combobox selection)
  • gordkgordk St.Catherines On. Canada.
    edited 1:36PM
    in the dialog with the combobox write code to set the groupheaders condition.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.