0
votes

Using Crystal Reports 10 and vb6/classic (although I expect its the same in any language), is it possible to change a suppression formula on a Group header section dynamically from code.

I'm basically changing the GroupConditionField on a specific group dynamically according to user input, but on that group header there is a suppression field formula containing a check on a grouped sum.

Sum ({@ColourTotal}, {Table.Field}) =0

If this is true, the group gets suppressed. This obviously comes up with an error complaining it can't find the group when the GroupConditionField is changed through code.

So is there a way to change the suppress formula for a specific group from within code?

2

2 Answers

0
votes

I apologize this is C# but I had it handy. I need to so something similar so I have a formula that I set to a value from my program. The report checks this value to decide whether to suppress or not. I suspect you can use the same technique to change the formula, but I'm too lazy to test it my self.

report.DataDefinition.FormulaFields["Florida"].Text = (Convert.ToBoolean(option.EffectiveValue) == true ? "1" : "0");

This code just sets the formula field, "Florida" to either 0 or 1.

0
votes

I believe I have found a way to do it using the Group Selection Formula under Report->Selection Formulas-> Group inside the actual report.

Not ideal and will involve some reformatting but should work.