nerdalert
nerdalert

Reputation: 461

Crystal Reports:Hide/suppress field in report depending on user input/parameter

So I have attached a picture of my app below. What I have is a Winforms C# app where the user can generate a barcode. He enters the parameters on the left, clicks Generate, and the Crystal Report is shown on the right with the barcode in a 4x12 format. I created the report template manually, i.e added Blob fields on the report in the positions I wanted through trial and error, and when the user clicks generate, it simply passes the image to the report.

enter image description here

I plan on adding a facility where the user can choose which slots on the report to actually generate an image, because perhaps he doesn't want to print 48 barcodes at a time. So maybe a checkboxes or something where the user will determine at runtime how the report will generate.

So my question is, what is the best way to do this? I was thinking of passing a list of the desired slots to the report as a parameter, and hiding or suppressing the fields depending on the list, but I don't know how to do this. My Crystal reports knowledge isn't the greatest. I only found ways to suppress data in cases of duplicate data, but I have a somewhat unique case where there isn't much info out there.

Upvotes: 1

Views: 5122

Answers (1)

Norberto Escobar
Norberto Escobar

Reputation: 190

to suppress an item using some condition I do it as follow:

  1. select the item (that could be suppressed based on the condition)
  2. right click on the item
  3. select "Format Field" or "Format Text"
  4. in the tab menu select "Common"
  5. in the common tab look for Suppress (it is a checkbox) and check it the click on the button that have a x+2 and a pencil,
  6. write your condition
  7. you may do it the other way around (unchecked textbox and condition to hide)

an example of mine: (?official is a parameter I sent)

IF {?Official} = true THEN

true

ELSE

false

Upvotes: 4

Related Questions