Group condition

theodoretheodore Greece
edited 5:33AM in FastReport 2.xx VCL
Hello and congratulations for http://www.delphizine.com/portal/ (product of the year 2004).
I have some problems when i try to change from a button event the group condition.
The first page of my report is a dialog and according to users choices i built up a group condition using the ok button's script. When i try to change by using group1.condition:='xxxx'; i get some access violation message "address 400048A4 module rtl60.bpl write of address 00000104". If i try the condition change by hand at design time, the group works great. I also tried to make a condition made of variables, which also works, but i need to change it sometimes with a very diferrent one (from something like group by date for every 10 days to group by monthof date). Is there any solution or can i use diffirent groups with conditions and disable the groups (also the group's obp) according to script?
Regards
Theodore

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 5:33AM
    you may be entering an impossible string try
    '[whatyouwant]' ot ''''+'whatyouwant'+''''the parser just like delphi strips leading trailing apostrophes
    so it is just like building a filter string.
    also remember the underlying query/table must be sorted by the condition as well.
    regards ;)
  • theodoretheodore Greece
    edited 5:33AM
    gordk wrote:
    you may be entering an impossible string try
    '[whatyouwant]' ot ''''+'whatyouwant'+''''the parser just like delphi strips leading trailing apostrophes
    so it is just like building a filter string.
    also remember the underlying query/table must be sorted by the condition as well.
    regards ;)
    Did it already as i described...
    Everything seems to work when i copy-paste the condition but crashes when i use the event to set it by script!!!
    Something else?
    Thanks
    Theodore
  • gordkgordk St.Catherines On. Canada.
    edited 5:33AM
    Post a snip of the code where you are trying to change it.
    regards ;)
  • gordkgordk St.Catherines On. Canada.
    edited 5:33AM
    Hi theodore
    here is a method
    add a variable to the datadictionary
    ie Mgc
    set group header condition to [Mgc]
    hereis a sample of code for the onclick button of the dialogdorm
    begin
    if cb1.checked then
    Mgc:='[Copy(Company, 1, 1)]'
    else
    Mgc :='[Copy(Company, 1, 2)]';
    end
    tested on demos\reports demo keep footer together report just added dialog page
    and components and made change above.
    Note the function passed in to variable as a string could also be written
    Mgc:='[Copy([Company], 1, 1)]'

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.