How to conditioanlly hide group header in crystal report based on a column value in details section - crystal-reports

I hope some one must have dealt this situation before.
I have a crystal report and on that report I have different sections including headers ,detail and footer. I'm displaying parts related information on details section and description is one of the fields thats being displayed.
So now based on part's description(in detail section)I have to display some text on the page header. So I have to look for part's description for every single part ,and if even a single part has the given description out of all the parts I have to print a message on report header.
My assumption is to use conditonal suppress option at the page header section, but not sure how to check for values from details section at the page header level.
Any help will be highly appreciated.
Thanks
NAF

Here's the way I would approach it.
Create a formula which returns 1 when your condition is met- otherwise 0. For example:
if {table.field} like '*acid*' then 1 else 0;
Then your conditional surpression can sum your new formula- and if the result is 0 it will hide the message.
sum({formula}) = 0

If you want to display it in Report Header then i would use a SQL Expression to conditionally suppres the text you want.
The SQL Expression
(select count(1) from dbo.TABLE where description = 'my_description')
Then in the Suppress formula:
{?SQL_EXPRESSSION} = 0

Related

How does one dynamically take values from a Group, add it to an Array, and then print individual values in the Page Footer?

I have a report file, where the report provides information on a "Job" - so this is a "Job Ticket" report. Inside the Job Ticket, there is a group with details that provides information on individual "Components" of which there can be anywhere from 1 Component to 6 Components in any given Job. There is a field applied to each component which is a string and is the "ComponentType" ({sp_JobTicket.ComponentType}).
What I would like to do is put the value of each row of ComponentType into an Array, which I can then call in the Page Footer (i.e., so I can create a Text Object and in it call a value using something like "TypeforComponent[3]"), so even though every printed page will only show the full details of one component, the page footer for each page will provide an at-a-glance view of all the components and their types.
As it is right now, we just hand write the component types for all components on the printed page itself, but we can access the ComponentType through the database, so it seems like we should be able to get it to print on the report.
Here is a full page preview of of a printed Job Ticket report that has 4 components (so in the Page Footer only 1-4 would have a value, 5-6 are empty), and where everything is currently laid out, and where we're hoping to get things placed:
Lots of questions but assuming this report is run for only 1 job ticket at a time here is one possibility:
Create formula called CT_Array and place in header1 section and suppress:
WhileReadingRecords;
stringvar array CT_Array ;
stringvar output := "";
numbervar i := ubound(CT_Array)+1;
redim preserve CT_Array[i];
CT_Array[i] := {sp_JobTicket.ComponentType};
Then create 6 formulas (CT_Var1 through CT_Var6) to read as follows:
WhileReadingRecords;
stringvar array CT_Array ;
CT_Array[1]
Replacing CT_Array[1] with the next array element number
Place those formulas where needed in page footer.
CT_Var2
WhileReadingRecords; stringvar array CT_Array ;
if ubound(CT_Array) >
1 then CT_Array[2] else ""
etc... for CT_Var3 through 6
So it looks like the simpler and more straight-forward solution to my problem was to not use an Array, but to create a Subreport.
I accomplished this by creating a new report, linked it to the stored procedure used by my Job Ticket (main) report, and imported the data fields I needed. I then proceeded to change the Page Size for the subreport to fit into the size on the page (1.5" x 1"), set the Details section to "Format with Multiple Columns" in the section expert which made available a new "Layout Tab" which I entered and selected "Format Groups with multiple column[s]." Then I saved that as a separate file and imported that report into my main report as a Subreport. Finally I set the Subreport Links to link to my "JobNumber" field which my main ticket uses as a parameter and that Field to the parameter.
Completed Successfully:

Two different pages with distinct headers and footers in crystal reports

Right so I'm fairly new to this crystal reports thing and i've been stuck with this for days and can't get my head around it!
i have to produce a report which contains two pages - 1. purchase order and 2. receiving note
report 1. has its own
header
detail
footer
report 2 has distincts header, detail and footer.
the only way i managed to make this happen was to use subreports but they only work in 1 level deep so having the addresses in subreports themselves i can't use this!
Now ive tried creating new groups and all of that but i cant get it to show in different pages
right now i have
header1
header2
details1
details2
footer1
footer2
any ideas of what could i do please?
If you know that page 1 and 2 are always page 1 and 2 (and a page 1 doesn't spill over into the 2nd page pushing the original 2nd page out to the 3rd page) then you can use a formula to change the header based on the page number. Create a new formula and then you can do something like this:
Basic Syntax
If PageNumber = 1 Then
formula = "This is the page header for page 1"
ElseIf PageNumber = 2 Then
formula = "This is the page header for page 2"
End If
That said, I probably would probably stick to using sub reports and use the report headers in those reports to display your unique headings. Using the section expert you can make sure that there is a page break between the two sub reports.

In SSRS How not to split same column on 2 pages

I have 20 columns on report. We have provided user to exclude columns which don't want in report. So we made hidden.
Problem is when I get report then any last column on page gets appeared some part on 1 page & some part on another page.
Can you please help.
hi i hope i understand your question correctly. you want to avoid page breake for a tablix? mark the tablix go to properies and check the PageBreak Options for me tDisabled = True works to render all informations in one page.
if it is still not working check your pagelayout in report --> report properties
also i remember there was a InteractiveHeight Option somewhere that should be set to 0.

Insert page breaks between report groups with two-sided printing

In group expert options I have set Keep Group Together, which makes sure a new page is set.
With two-sided printing enabled, how can I make sure that a new group always forms on a new sheet of paper? Can this be done in the formula expert? Is there some way of checking if the page I'm on is even or odd and insert a page from there? Just asking leading questions because I'm not familiar with what is possible with Crystal's formula editor. BTW, This is Crystal XI Enterprise Server.
You can do this with the onfirstrecord, pagenumber and the onlastrecord keywords.
On the group header section "New page before" formula...
not onfirstrecord //so every group (except the first) starts on a new page
On "New page after" formula...
//to keep the group from starting on even page but make sure the last page is not blank
remainder(pagenumber, 2) = 1 and not onlastrecord
Open the Section Expert screen. Select Report Header and check "Suppress (No Drill-Down)". Then select in the group header select the group you want to page break and check "New Page Before".
This Works fine if I need Page Break on one Group. How do I do if Page Break on Multiple Groups?
I found answer..
Using Next(Field) or Previous(Field), I added below condition and worked fine.
In Next Page Before formula:
Not onFirstRecord and ({table.field} <> previous({table.field}))
hi IronicMuffin i understand you question. the answer is versy simple but more effetcive.
step 1: Include dataset or database expert into your crystal report
Step2: In the outside surface of the report area right click and goto report and goto group expert
Step3: add the which field you include the group that time the bottom of the window options will appear
Step 4: click the option and agian goto 2nd tab of the option.
step 5: finally check(check=true) check box of Repeat Group header on each page other check box or put uncheck

Crystal report - Header suppress

In Crystal report how we suppress page header on pagenumber >= 2 when records are completed on the previous page
Go to the Section Expert of the header. Suppress it with the checkbox and then, in the suppression formula, do this (with Basic syntax):
if pagenumber > 1 then formula = true
Maybe this will help? Just make a couple headers and a conditional that hides on the non-first page...
In the suppress formula box you can simply enter
Pagenumber<>1
This is true for all but the first page and thus will suppress on all but the first page.
Maybe you want to suppress the header on the second page if there is no record in the Detail section.
Please take a look at
Number of details records on the crystal report page