Sei sulla pagina 1di 5

1. What are the Sections in Crystal Report?

Usually there are 5 Sections in Main Report,


1.ReportHeader
2.PageHeader
3.Details
4.PageFooter
5.Report Footer
And there are 3 Sections in Sub Report
1. Report Header
2. Details.
3. Report Footer
Based on the user requirement we can insert more Sections

2. How many sub report can contain in Main Report?


Crystal Report having some restrictions, so we can insert up to 256 Sub reports in Main
Report

3. Can we use sub report with in sub report?


No, it’s not possible to insert Sub report within a Sub report

4. What is Shared variable in Crystal Report?

Shared variables use the same memory block to store the value of a variable throughout
the main report and all of its subreports. Thus shared variables are even more general
than global variables. To use a shared variable, declare it in a formula in the main report
as in the following example:

Shared NumberVar x := 1000;

And declare it in a formula in the subreport as in the following example:

Shared NumberVar x;

In order to use shared variables, the variable must be declared and assigned a value
before it can be passed between the main report and the subreport.

5. What is Global variable in Crystal Report?

Global variables use the same memory block to store a value throughout the main report.
This value is then available to all formulas that declare the variable, except for those in
subreports. You declare a global variable as in the following example:

Global StringVar y;

You can also omit the Global keyword which creates a Global variable by default:

StringVar y; //Same as: Global StringVar y;

6. What is Local variable in Crystal Report?


Variables with local scope are declared using the Local keyword followed by the type
name (with the Var suffix) followed by the variable name.

Local variables are restricted to a single formula and a single evaluation of that formula.
This means that you cannot access the value of a local variable in one formula from a
different formula.

Example

//Formula A
Local NumberVar x;
x := 10;
//Formula B
EvaluateAfter ({@Formula A})
Local NumberVar x;
x := x + 1;

7. How do you link Sub report in to main report?


Select Sub report links in Edit menu. Drag the Fields from Available Fields Box to
Field(s) to link to Box. Now select the Sub report parameter Field. And then select sub
report Field to use. Now click OK

8. What are the Variable Types in Crystal Reports?

Before using a variable in a formula, you must declare it. A variable can hold values of a
given type. The allowed types are the seven simple types (Number, Currency, String,
Boolean, Date, Time and DateTime), the six range types (Number Range, Currency
Range, String Range, Date Range, Time Range and DateTime Range) and variables that
hold arrays of the previously mentioned types. This gives a total of 26 different types that
a variable can have.

9. How Do you declare array variable in Crystal Report?

You can declare array variables by following the type name with the keyword Array.

Global NumberVar Array x := [10 , 20, 30];

You can assign values to elements of an array and also use the values of the elements for
other computations.

StringVar Array x := ["hello", "bye", "again"];


x [2] := "once"; //Now x is ["hello", "once", "again"]

The Redim and Redim Preserve keywords can be used to resize an array if you want to
add extra information to it. Redim erases the previous contents of the array first before
resizing it whereas Redim Preserve preserves the previous contents.

Local NumberVar Array x;


Redim x [2]; //Now x is [0, 0]
x [2] := 20; //Now x is [0, 20]
Redim x [3]; //Now x is [0, 0, 0]
x [3] := 30; //Now x is [0, 0, 30]
Redim Preserve x [4]; //Now x is [0, 0, 30, 0]

Arrays are commonly used with For loops. The following example creates and then uses
the Array [10, 20, 30, ..., 100] using a For loop.

Local NumberVar Array b;


Redim b[10];
Local NumberVar i;
For i := 1 To 10 Do
(
b[i] := 10 * i
);
b [2] //The formula returns the Number 20

10. What is Differences between ODBC and ELEDB in Crystal Report?


If we Use OLEDB, then we don't need to set up the DSNs, and it will wait for the
Database to finish the SQL before releasing control. ODBC Connect did not have this
issue

11. How do you use chart in Crystal Report?


To Insert Chart in Report, Select Chart in Insert menu now select the chart type,
And the select the Data Tab and then Drag the available Fields to OnChange of
Dropdownlist box and then drag the Available Fields to Show Values and Change the
Summary option based on your Requirement, And then Select the Text Tab, And Modify
the Titles as Per Requirement and Format also. Click OK

12. How do you create Custom Functions?

13. What is running Total? And how can you use in Details Section?
Running Total used to summarize the Field Value.

1) Summary: the Field to Summarize and the Type of Summary operation: Normally you
would select a numeric field or formula and SUM that field.

2) Evaluate: How often do you want to calculate this summary? Usually it’s every record,
but you also control less frequent calculations by selecting an evaluate on change of
group. We don’t recommend the use of "on change of field" as the sequence of your data
can cause this to go horribly wrong. Change of group is a lot safer, even if it requires the
creation of an extra group in your report.

3) Reset: When do you want to set the total back to zero? Is this a running total that
accumulates all the way through the report, or do you go back to zero on the change of a
group field?

If we Use the Running Total in Details Section, It will be modify the Result for each
Record

14. In Crystal Reports (CR), is it possible to display every nth record without indexing
the Database table?

For example, you have a report with 100 records but you only want to see every 25th
record. Your report connects to a database table that does not contain an indexed field.
1. Right-click on the details section and click 'Section Expert'.
2. Leave the check box cleared and click the 'X+2' command button next to 'Suppress
(No Drill-Down)'. The formula editor opens.
3. Enter the given formula: Remainder((recordnumber),25) <> 0

15. How do you display just the report file name on the report?
To display just the report file name on a report, Create a new formula similar to this:
StringVar Array File:=Split(filename,'\');
NumberVar i := Ubound(File);
File[i];

16. How can you suppress a blank sub report from displaying on the main report?
To suppress the blank subreport, complete the following:
1. In the main report, right-click the subreport object and click 'Format Subreport'.
2. Select the subreport Tab,
3. Check the checkbox of Suppress blank subreport.

17. How can you share sub report data with the main report of the Crystal Reports
Designer?
Using the shared keyword we can share the sub report data with in the main report.
For example:
1. In the sub report, create a @MainFormula formula similar to the one below:
WhilePrintingRecords;
Shared CurrencyVar myTotal := Sum ({Orders.Order Amount})
2. Place this formula in your subreport.
3. In the main report, create a formula that declares the same variable name:
WhilePrintingRecords;
Shared CurrencyVar myTotal;
myTotal
4. Place @MainFormula in a main report section that is beneath the section containing
the sub report.
5. Once you have verified that @MainFormula is returning the correct value from the
subreport, you can include this formula in other main report formulas, such as:
{@MainFormula}+ Sum ({Customer.Last Year's Sales})
6. Place this formula in the same section as @MainFormula, or in a section further down
on the report.

18. How can you evaluate this database field in formulas or record selection criteria to
return the expected result set?
A) STEPS TO CONVERT NULL FIELD VALUES TO DEFAULT VALUE FOR ALL
FIELDS IN CR
1. Click File > Report Options
2. Select the 'Convert NULL Field Values to Default' check box.
3. Click 'OK'.
B) STEPS TO EVALUATE THE NULL FIELD VALUES IN CR
1. Create formula or record selection criteria.
2. Use the IsNull function at the beginning of the formula or record selection criteria.
3. If applicable, specify a value or action if the IsNull function evaluates a null record.

19. Where do you find the 'Keep Together' options in CR and how do they affect your
report?
To locate the 'Keep Together' option for the different sections of the report, follow these
steps:
1. In the Section Expert, select the section.
2 Under the Common tab, select 'Keep Together' check box.
When the 'Keep Together' option is selected, CR keeps the entire instance of the
particular section on the same page.

20. How can you format occurrences of a specific word or character within a string
field?
1. Create Formula as @StringFormat
2. Place the below said Formula in @StringFormat
Replace( "Mohanbabu ", "babu", "<b>babu</b>")
3. Place the formula @StringFormat in Report, Right Click the formula and the Select
Format Field
4. In Paragraph Tab, Select HTML Text in Text Interpretation
5. It will Display the Result as Mohanbabu

Potrebbero piacerti anche