choices-760701One of the most powerful attributes of the D-Tools report designer is the ability to use parameters in your reports. These parameters give you the ability to make choices on how a report should be run. The standard D-Tools proposal reports provide many different parameter choices right out of the box such as: ability to hide or show the model number or line item pricing to name a few.



The parameter settings can be saved as report definitions (report definitions allow me to setup a report to be run several different ways). Report definitions show up underneath a report template that expands with a “+” sign and look like this:

definitions

For an overview on how to edit and add report definitions to these standard reports Click Here.  Watch the 4th video down from the top.

Adding Report Parameters

For the more adventurous report customizer, adding additional parameters to your reports in the report designer might be something you want to investigate. In this post I am going to describe the process for adding a parameter to a new proposal report (created based on the standard report = ‘Proposal’). I am going to teach you to add a parameter to hide the group level pricing field (or not).

To add a parameter to a report you must do two things:

1. Add a parameter value to the report in the New Report Wizard. This is where you define what type of parameter you want to add. This screen looks like this:

parameter

Once this parameter value has been added, take note of the type of field we’ve set it up to be; in this case a Boolean field (true/false). Also take note of the parameter name (ShowGroupPrice). Both of these will be necessary when writing your script for the parameter to work properly.

2. The second step is to add the necessary script (on the script tab in report designer) in order for the report to function properly and behave the way you want it to. As with anything – as the level of complexity of what you’re attempting to do increases so will this required script. The D-Tools Forum provides some answers – try a search.

When adding a parameter like the one I described above – you will need to add the script into each section where you want to affect the output of the report. In the case of the report example I’m working with, the group subtotal pricing is potentially located in 3 sections of the report (depends on how many groups you’re using):

  1. GrpDyamicFooter1
  2. GrpDyamicFooter2
  3. GrpDyamicFooter3

Each one of these sections will need parameter script in order for it to show/ hide the price subtotal in that section.

I wrote the following script for this parameter to work and provided some color coding to help explain it.

  • Red = Code for each section (Open and Closing the code for that section)
  • Green = My Notes (preceding any text with a ‘ comments it out of the code and it won’t affect the report.)
  • Blue = The Code itself



‘Parameter code starts here for controlling the visibility of Group Subtotal price fields

Sub GrpDynamicFooter3_Format

‘Return the parameter value

Dim GroupPriceParam As Boolean = ReportUtilities.ReturnParameterValue(“ShowGroupPrice”)

‘Code to hide the subtotal section

ReportUtilities.SetSectionVisibility(rpt,”GrpDynamicFooter3″, GroupPriceParam)

End Sub


Sub GrpDynamicFooter2_Format

‘Return the parameter value

Dim GroupPriceParam As Boolean = ReportUtilities.ReturnParameterValue(“ShowGroupPrice”)

‘Code to hide the subtotal section

ReportUtilities.SetSectionVisibility(rpt,”GrpDynamicFooter2″, GroupPriceParam)

End Sub


Sub GrpDynamicFooter1_Format

‘Return the parameter value

Dim GroupPriceParam As Boolean = ReportUtilities.ReturnParameterValue(“ShowGroupPrice”)

‘Code to hide the subtotal section

ReportUtilities.SetSectionVisibility(rpt,”GrpDynamicFooter1″, GroupPriceParam)

End Sub
‘Parameter code ends here for controlling the visibility of Group subtotal price fields


Breaking it down:

Dim GroupPriceParam As Boolean = ReportUtilities.ReturnParameterValue(“ShowGroupPrice”)

This section of code returns the value of the report parameter set in the report’s definition. This (“ShowGroupPrice”) must be spelled exactly as it was in the report setup when you declared the parameter as a variable in the report.

ReportUtilities.SetSectionVisibility(rpt,”GrpDynamicFooter1″, GroupPriceParam)

This section of code tells the report set the GrpDynamicFooter1 section’s visibility based on the value of the GroupPriceParam (remember it is a Boolean value that is either True or False). So we basically just use the result of that parameter setting as our true/false for visibility.

Making this customization

  1. Copy the ‘Proposal’ report and create  a new report of your own.
  2. Add the parameter as described above.
  3. Navigate to the script tab in the report designer.
  4. Copy the script above and paste to the bottom of your script. Make sure not to change anything else.
  5. Publish the report
  6. Edit a specific report definition and set the parameter’s value
  7. Run the report to test it out

I encourage you to make this customization yourself to help familiarize yourself with the process; however I have made a sample of this report available after you join my QuickTips group on my website. Register Here and I’ll email you the report.