Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: How to suppress field based on param? Post Reply Post New Topic
Author Message
Gabor
Newbie
Newbie


Joined: 27 Nov 2007
Location: Hungary
Online Status: Offline
Posts: 1
Quote Gabor Replybullet Topic: How to suppress field based on param?
    Posted: 27 Nov 2007 at 6:57am
Hi,
 
I have a report, that contains a subreport, like invoice/invoiceDetail.
 
Depending on a paramValue, I want to suppress some fields on subreport.
 
I created a paramField string type via designer on a subreport.
 
I set the supress checkbox on the formula editor, and wrote the formula below:
 
{?IsShowValue}="yes"
 
Then with the code tried to set value to the parameter:
 
I created a sub, that get the subreport, paramname, and paramvalue as parameter, and set the paramvalue.

Private Shared Sub SetBooleanParamValue(ByVal rpt As ReportDocument, ByVal paramName As String, ByVal param As String)

Dim parameterFieldDefinition As ParameterFieldDefinition

parameterFieldDefinition = rpt.DataDefinition.ParameterFields.Item(paramName)

Dim ParamValues = New ParameterValues

Dim ParamValue = New ParameterDiscreteValue

ParamValue.value = param

ParamValues.add(ParamValue)

parameterFieldDefinition.ApplyCurrentValues(ParamValues)

parameterFieldDefinition.CurrentValues.Add(ParamValue)

End Sub

My problem; despite I set the CurrentValues, when I open the report, the parameter settings form appear, as if I haden't set the parameter via code before.
 
What have I missed?
 
Thanks
 
Gabor
IP IP Logged
Imtiaz Ahmed
Newbie
Newbie
Avatar

Joined: 11 May 2009
Location: India
Online Status: Offline
Posts: 6
Quote Imtiaz Ahmed Replybullet Posted: 12 May 2009 at 12:45am
Try using this piece of code ...
 

crReportDocument.ReportDefinition.Sections(1).ReportObjects("Text4").ObjectFormat.EnableSuppress = True

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.