Create and print custom formats with Print When and If Statements
When creating a custom format, there may be situations when you don't want something to print unless a specified criteria is met, or you want to print something else when the specified criteria is or isn't met. The Practice CS Custom Formatter provides 2 tools you can use to control what prints on the output.
- Print Whenformulas
- If Statements
Print When formulas
A
Print When
formula controls whether an item will print on the document or not. The item will print only if the Print When
formula is set to True
, and won't print if the Print When
formula is set to False
.- You can applyPrint Whenformulas to individual fields or whole sections of the format.
- The basic structure of aPrint Whenformula is: print this item only if [variable] [operator] [value].
- Invoice Example:Print the adjustments amount only if it's not equal to 0.
- The expression to use for this:[AR Activity Adjustments(Key(Client), Detail Line Date From(1), Detail Line Date To(1)) <> 0]
- Everything before the<>operator is the variable that represents the adjustments. You don't need to know how to build this variable since it's already in the OutputValue Formula screen. Double-click the field to open the OutputValue Formula screen. You can then highlight and copy the variable.
- The operator<>which representsnot equal to. Other operators include:
- =: equals
- <: less than
- <=: less than or equal to
- >: greater than
- >=: greater than or equal to
- Finally, the value against which the variable is compared is 0.
- To add thePrint Whenformula to a field:
- Select the field to highlight it.
- In the Properties pane, go to thePrintWhenattribute in the Suppression section.
- Select thePrintWhenfield, then

- Enter the formula in the center section of thePrintWhenFormula window.
- SelectOK.
- Because we are removing the value of the adjustments amount when its value is 0, we want to also remove the label before the value field if the adjustments amount is 0. To do this, repeat all the previous steps except highlight the field that contains the label instead of the field that contains the variable.
- Finally, if the adjustments is 0, and neither field prints, it will leave an empty space. To avoid this, set theCanShrinkattribute in the Behavior section of the properties toTruefor both fields.
- To add aPrint Whenformula to a section:
- Follow the instructions for adding aPrint Whenformula to a field, except select the header.
- In the following example, theDetailsection prints a line for each WIP transaction in each engagement. We don't want to print the line if the hours is 0.
- To effect this, select the header of the Detail section which shades the header and then add aPrint Whenformula in the properties of the header as described previously for an individual field.
- ThePrint Whenformula is:[Billing Decision units closed(Billing Decision) <> 0].
- Everything before<>is the variable for the hours on an individual transaction.
- Because the group repeats each transaction, it's not necessary to set theCanShrinkvariable as we did for individual fields.
If Statements
If Statements
are an another way to control what will print on the format.- The primary differences between aPrint Whenformula and anIf Statementare:
- APrint Whencan only suppress the printing of an item.
- AnIf Statementcan print something different if the condition is false.
- If Statementscan only be used for individual fields.
- ThePrint Whenonly suppresses whether the item is printed. However its value is still included in any subtotals and totals based on the variable. If the value of a variable is suppressed by anIf Statement,then that value isn't included in subtotals and totals based on the variable.
- The basic structure of anIf Statementis:IF([variable] [operator] [value], [what to print if true] , [what to print if false)].
- TheIf Statementcould've been used in place of thePrint Whenon the adjustment amount. An example would be:[IF(AR Activity Adjustments(Key(Client), Detail Line Date From(1), Detail Line Date To(1)) <> 0, AR Activity Adjustments(Key(Client), Detail Line Date From(1), Detail Line Date To(1)), "")]
- Practice CS includes a tool to help you buildIf Statements. Follow these steps to create anIf Statement.
- Double-click the field where you want to insert anIf Statementto open theOutputValue formulascreen.
- Select theIf Expressiontab.
- Find the variable to test in the variable tree. In this example the variable isClient,A/R,Activity,All Adjustments.
- Select and drag it into theIf conditionfield.noteIf the field already contains the variable, you can cut and paste it into theIf conditionfield.
- Select anOperator. In this example, the operator is<>(not equal to).
- Enter the value to compare with into the area markedEnter the criteria for the condition here. The value can be another variable, a number, or an alpha expression. In this example, we're testing the variable for a value of 0, so we enter 0 in the field.
- In theThen printfield, enter what to print if theIfcondition is true. In this example, the value is the field being tested,All Adjustments.
- In theOtherwise printfield, enter what to be print if theIfcondition is false. In this example the value is blank—nothing is entered here.
- SelectApplyto have Practice CS build theIf Statement.noteWhen you selectApply, the values in all the fields will be surrounded by square brackets and a blank is changed to 2 quotation marks.
- SelectOKto save theIf Statementin the field on the layout.