Click to See Complete Forum and Search --> : [RESOLVED] VB.Net Crystal Viewer does not like Formula


gamersrant
November 19th, 2007, 06:24 PM
I am working on a report that has the group header split in two. The second header needs to be invisible until people drill down to the next level. To do this I put the following formula on the suppress section of the header:

if (drilldowngrouplevel = 0) then formula = yes else formula = no

The formula works fine in crystal but whenever I try to view the report in VB crystal viewer in a VB application I get this message:

http://i158.photobucket.com/albums/t96/gamersrant/Untitled-1copy.jpg


I don't understand why it has a problem with the formula. I set the syntax for all formulas on the report to basic syntax and set default value for nulls. Does anyone have any ideas why this may be happening. Even when I changed the code to use an elseif statement like this:

if (drilldowngrouplevel = 0) then
formula = yes
elseif (drilldowngrouplevel <> 0) then
formula = no
end if

the message says that it is expecting a number, currency amount, date, time, etc... after this part of the code
'if (drilldowngrouplevel = 0) then
'

gamersrant
November 21st, 2007, 10:13 AM
I found the problem and it is the drilldowngrouplevel function works in crystal but when it is in the .net viewer it causes the errors listed above. Is there something I am missing in my report or application that is causing this problem?

gamersrant
November 26th, 2007, 02:17 PM
I found the answer to the problem http://vbcity.com/forums/topic.asp?tid=136221&highlight=DrillDown
So all I did was add a boolean parameter to my report named drill. Then I set the group header 1b to suppress if the value of the field was false. Then in my vb program when I first sent the parameters I sent that parameter with a value of false. Then put this code in the drill event in my crystal report viewer in vb:

Dim PDrill As New CrystalDecisions.Shared.ParameterField
Dim DDrill As New CrystalDecisions.Shared.ParameterDiscreteValue
PDrill.ParameterFieldName = "drill"
DDrill.Value = True
PDrill.CurrentValues.Add(DDrill)
PFields.Add(PDrill)

This will change the value of the variable to true and the second header will no longer be suppressed.

alphie
September 14th, 2008, 03:42 PM
Hi.

I found an easier solution.

Just make that second group header section suppressed.
After that, on DRILL event in .NET, just add this code:

// disable suppressing when the user drills down

reportName.SectionName.SectionFormat.EnableSuppress = false;

Just replace reportName and SectionName with whatever is the case in your app.

You can also enableSuppress when you first load the report..so if someone drillsdown and then returns and runs the report again, the region will be suppressed.