0 like 0 dislike
30 views
in Computer Science by (1.0m points)
How can you apply a sort order to the report?

1 Answer

0 like 0 dislike
by (1.0m points)
Using parameters in Crystal Reports for Blackbaud allows you to easily change a report's sort order without changing the report design. Parameters allow you to change the report to meet your needs. For example, at times, you want to sort the report by Constituent Name, but at other times you may want to sort by State. You can use parameters to "tell" the report which sort order you prefer. Follow these basic steps:

Create the Parameter

Select Insert, Parameter Field from the menu bar and click New.

Name the parameter Sort Order; you will use this name in the formula.

Enter the following prompting text, which the user will see when he or she runs the report: Sort Order? Name (N) State (S) Code (C)

In the Value Type field, enter String as the answer value type the user will enter. You may also enter a default value. Click OK.

Edit Parameter Field

Create the Formula

Select Insert, Formula Field from the menu bar and click New.

Name the formula Sort and click OK. You will use this formula when you group the report.

In the Formula Text box, create the following formula, which calculates the sort order based on the user's answer. Click Accept.

if Not IsNull({?Sort Order}) then

if UpperCase ({?Sort Order}) = "S" then {Constituent.State - Primary} else

if UpperCase ({?Sort Order}) = "C" then {Constituency.Code Description} else

if UpperCase ({?Sort Order}) = "N" then {Constituent.Sort Key} else {Constituent.Sort Key}

This formula will instruct Crystal Reports to calculate the uppercase format of the response and create a final result. If the user leaves the prompt blank, it will use the Sort Key as the final result.

 Insert the Group

Select Insert, Group from the menu bar.

Select the formula that you just created: @Sort. Then select the order you prefer and click OK.

Insert Group

When you preview the report, you will be prompted to select a sort order. In the following example, Crystal Reports will calculate the result of Constituent.State - Primary and group on that field.

Parameter Values

In order to have the choice of Sort Order (Ascending/Descending) simply create two reports. One with the Group in Ascending order and the other with Descending order.

If sorting by multiple data types (ex: String, Number, Date etc) a separate group and formula will need to be created. Examples of sorting by a Number and a Date field in Descending order:

Create two new formulas (Insert, Field Object, Formulas, New)

Name: GroupSortTarget

Formula: if {?Sort Field} = "Number" then {NUMBERFIELDNAME.EN_US} else 0

Name: GroupSortDate

Formula: if {?Sort Field} = "Date" then {DATEFIELDNAME.EN_US} else #1/1/1111#

Create two new groups (Insert, Groups)

Group 2 - Select Group Sort Target, Descending Order

Group 3 - Select Group Sort Date, Descending Order, This section will be printed=for each day

Related questions

0 like 0 dislike
2 answers 154 views
0 like 0 dislike
1 answer 19 views
0 like 0 dislike
1 answer 28 views
0 like 0 dislike
1 answer 39 views
0 like 0 dislike
1 answer 40 views
0 like 0 dislike
1 answer 30 views
0 like 0 dislike
1 answer 75 views
asked Feb 14, 2019 in Computer Science by danish (1.0m points)
0 like 0 dislike
1 answer 30 views
Welcome to Free Homework Help, where you can ask questions and receive answers from other members of the community. Anybody can ask a question. Anybody can answer. The best answers are voted up and rise to the top. Join them; it only takes a minute: School, College, University, Academy Free Homework Help

19.4k questions

18.3k answers

8.7k comments

3.3k users

Free Hit Counters
...