Group condition
theodore
Greece
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
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
'[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
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
regards
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)]'