Dynamic vertical lines in Crystal Reports 10.5 - crystal-reports

Crystal Reports Ver 10.5
I have a crystal report which shows up to 9 fields, but user can choose between 1 to 9 fields. I have implemented this using check boxes on a form and user can select any box from 1 to 9 and generate a report. So the report can show from 1 field to 9, and any columns can be any field at a given time. (for eg. the user might select ID, Name, Phone from the form and view report. So the first column in the report becomes ID and so on. If he selected Name and Phone, the first column becomes Name and so on. I have done this using Parameter fields.
Now I would like to bring a vertical separation between columns and Only if the columns has data (Remember there can be 1 to 9 columns having data). I can't put the lines beforehand because they will be shown regardless of the number of fields shown.
Anybody has an idea of how to bring this vertical line between ?
Thanks in advance.

Related

Insert page number in Crystal Report

I'm building a Crystal report. I want to insert a page number for each page.
So, I have insert page number then in every page of my report, I can see
1
2
3
4
but now I want to insert this numeration:
1 of 4
2 of 4
3 of 4
4 of 4
How ca I do this?
In the field-explorer there are special-fields.
Take the pre-defined field called "Page N of M".
Alternatively you can create a formula with the following content:
ToText(PageNumber,0) & " of " & ToText(TotalPageCount,0)
(The 0 in the ToText-function removes the decimals from the page number.)
Crystal Reports provide inbuilt field to add page numbers.
Crystal Reports XI and Later:
Go to View -> Field Explorer
Expand on Special Fields
Locate the Page Number or Page N of M field and drag the field into the report
Crystal Reports 8.5:
Go to Insert -> Field Object
Expand on Special Fields
Locate the Page Number or Page N of M field and drag the field into the report

Crystal Reports set record number in formula

Would anyone know of a way to manually specify a record number within a formula, in Crystal Reports?
For instance, I have a report linked to an SQL server View that sits on top of a table that contains 20 records. This view selects the fields I need and then orders by the highest value to the lowest.
The report then pulls these records into the report in that order. What I would like to do is to be able to write a formula that can select a record based on its number.
I know I can reference RecordNumber in a formula (i.e. If RecordNumber = 5 Then...) but this only works in the Detail section once it actually shows record number 5, and if I place a formula in the header section it just displays False as the header only shows the first record.
I need to create a formula that sets the record number and then displays the desired value of that record number in the header (i.e. something like:
Set RecordNumber = 5
ToText ({table.value})
Can anyone help or is Crystal just not that sophisticated?

How do I get a 3 page report in Jaspersoft iReport Designer 4.7

First of all: I've read this question but it is not working for me.
What I need:
I have an SQL query that returns a 3 column set with about 50 rows that looks like this:
year | month | number
2012 | 1 | 35
2012 | 2 | 24
2012 | 3 | 127
and so on. Now I need two different representations of this data. The first one is a 2D bar chart and the second one a table with the numbers presented. I managed to do both, but what I'd like to have for the whole report is, to have 3 pages in total.
First page should be a simple cover page with the title of the report, which I can get by simply adding the title band, as far as I've understood. The second page should be the bar chart (filling the whole page) and the third page should be the table (also filling the whole page).
I've tried the following and didn't get the result I need:
Created 2 subreports (1 for bar, 1 for table), added them both in a main report (in the details band) with a page break in between. The result was 2 pages, but the chart and the table filled only half of their page. When I tried to resize the subreports to the full size of the page I got the error message that they're out of range...
Created 1 report with 2 detail bands. Added the chart into the detail band 1 and the table into the detail band 2. This worked for both elements to be the full size of the page, but the whole compiled report now has 100 pages --> 2 pages for one row in my sql set
So how can I accomplish what I need!? Is it even the right tool to use? Or should I simply create two reports, export them as PDFs and combine the PDFs by hand?
My suggestion - in your SQL query, add a fourth column that concatentates your year and month (let's call that year-month). Create a detail band with the following fields: year, month, number. Create a summary band for your chart with year-month as your x-axis and number as your y-axis. Make the title and summary bands the size of your output paper. In iReport, right-click on the name of your report and go to the Properties box for the report. Check the box for "Summary on a new page."

Formula for Suppressing Field if duplicate in Crystal Reports

I have a view which shows data on crystal reports where I have fields like tariff,rental,shares,gross and net.My problem is if someone changes the tariff in database it would show 2 rows of the same record with different tariff which is normal behavior from database point of view but I want to suppress the field of monthly rental to 0 if the same id has different tariff or the rental is repeated in new record.
ID Tariff Rental
1 20 390
1 15 390
I want the field of Rental on reports to be suppressed if duplicates based on id.Currently I have used this formula in crystal report to check previous field data and suppress if duplicate.
{DatabaseField}=Previous({DatabaseField})
It is working fine but if the id is not same and the rental is repeated then also it will suppress which I don't want.I want it to suppress only for same id.
You have to write the formula into field suppress. (No need on suppress if duplicated)
On Rental Field
{ID} = previous({ID}) and {rental} = previous({rental})
If ID and Rental are same then only the Report will suppress Rental.
I guess this will work for you.
In Crystal Reports, right-click on the Details section and select Section Expert.
In the Section Expert dialog box, select the X + 2 button beside the Suppress command. The check box must remain unselected for this formula to work.
In the Formula Editor dialog box, create a conditional formula containing the Next function to evaluate the records for duplicate values and to suppress the Details line
example:
{Table.Databasefield}=Previous({Table.Databasefield})
I had to make a slight change to the formula in the solution by Janarthanan by adding parenthesis to make it work with Crystal XI.
I used:
{ID}=previous({ID}) and {rental}=previous({rental})
this formatting variation, which is presented in the edited question, helped me to solve a similar problem.
Put this in suppress formula of field to hide.
if {myTable.ID} = previous({myTable.ID}) then
true
else
false

Addid Static Report Titile on Crystal Report

i have faced some problem , when i want to display some static Title after i have displayed a few number of Rows . for Example , the first 4 rouws on crystal Report has header"Training " the next 4 rows mmust have "Education " Report Header.
i am trying to display the report using by calling one Stored Procedures any one who can help me please??
You could insert a new detail section above your current detail section and have the new section only be visible based on record count or some value in the data. Add a new section in the details, Format Section->Suppress and enter a formula controlling when the new section is visible. For example, a running total field named InspIDCount and this formula in the suppress section ({#InspIDCount} mod 5 <> 0) will cause a blank row every 5 records. The new section could contain a formula to display the correct "title".
I think I misunderstood your question. The number of rows for each type is probably not constant. A better way to handle this would the to insert a group into your report if the data is not already grouped. Group by the record type (Education, Training Etc). You probably want to suppress the group header but show group by footer. The footer could display a field from the database showing the type or it could display a formula (string) based on the record type. It would only take a few minutes to give this a try.