How to determine if a table has rows in crystal 2008

Is there a crystal built in method to determine if a table in the crystal report has any rows?

I created an additional report that has a title of the title text and a detailed row with table information.

I want to be able to remove the title text from printing if there is nothing to print.

Also, is there a way to pass this to the "main" report so that I can completely disable printing the sub report if not printing?

Hello

+2


source to share


1 answer


Use the Count () function. Use it with one of the data source fields.

from Crystal Reports 2008 Help:

Overloads Count (fld) Count (fld, condFld) Count (fld, condFld, cond) Count (x)

The fld arguments are any valid database or formula field that the function can evaluate. condFld is a field used to group values ​​in fld. cond is a string indicating the grouping type for condFld. This argument is specified only if condFld is a Date, Time, DateTime, or Boolean field. For more information on valid strings for this argument, see Conditions for Summary Functions. x is an array of values ​​that can be evaluated with the function used.



Refunds Number

Action Allows you to count the values ​​displayed in the report (for the specified field). For example: If a sales report includes all orders and the quantity of each order, you can calculate the total number of orders displayed in the report (total quantity). If you break orders for groups (for example, orders grouped by the state they come from), you can calculate the number of orders per group (in this case, per state). If you break orders by date or boolean groups (for example, orders are grouped by the month they were placed in), you can calculate the number of orders per group based on a specific change in date or boolean field (in this case, per month). If you supply a set of individual values, you can calculate the number of values ​​in the set. For this type of counting, seeIn Concise Array Functions.

Examples The following examples apply to both Basic and Crystal syntax: Count ({orders.AMOUNT}, {orders.CUSTOMER ID}) This formula counts the number of orders in each order group in the Amount field (total orders for each customer). Each time you change the value in the Customer ID field, orders are split into groups. Count ({orders.ORDER AMOUNT}, {orders.ORDER DATE}, "monthly") Counts the number of orders in each order group in the Amount field (total orders for each month). Orders are split into groups when the value in the Date field changes to a new month. The following examples apply to Crystal syntax: If Count ({orders.ORDER ID})> = 100 Then "Congratulations on reaching your quota!" else "" Prints a congratulatory message,if the number of orders is 100 or more, and does not print anything if the number of orders is less than 100. Count ([1,2,3,4,5]) Returns 5. Counts the total number of values ​​in the array.

Note. Using this function in a formula forces the formula to evaluate at print time. For more information on evaluation timing considerations, see Evaluation time.

+2


source







All Articles