Section Topics
Calculated Fields
There are two types of fields in the InterAction Report Designer:
- InterAction fields
- Calculated fields
InterAction fields are data fields you choose to add to your report. For example, if you are creating a contact list by company, you may have included InterAction fields like Full_Name, Job_Title, Company_Name and Mailing_Address.
Calculated fields are formulas that use InterAction fields or date calculations to display the data you want. See the table below for examples.
Example | Description |
---|---|
=Sponsor is System.String ? Sponsor : "No Sponsor"; |
This statement says that if the Sponsor field contains data, then display that data in the Sponsor field. Otherwise, display the message “No Sponsor.” An easier way to display these results is to create a calculated field using the DefaultValue and Formula properties. For details, see Using Calculated Fields to Display a Message if a Field Has No Value. |
= "Contacts by Sponsor: " + Marketing_List; | This statement says to display “Contacts by Sponsor:” then follow it with the name of the current marketing list. |
System.DateTime.Now.ToShortDateString() | This calculation is a date calculation for the current date. |
Calculated fields are created in the Calculated section in the fields list. After you create a calculated field, you can use it in any field on your report.
Calculated Fields
[A] Create and edit calculated fields in the Calculated section of the fields list.
[B] Properties for the selected calculated field display in the properties box.
Create a Calculated Field
-
In the InterAction Report Designer, right-click the Calculated section in the fields list then choose Add.
-
With the new calculated field highlighted, type the properties for the field in the properties box.
-
In the Name field, name the calculated field. A recommended format is calc_ followed by the calculated field name. This helps distinguish calculated fields from other fields in your report.
-
Click on the FieldType field then choose the field type. Choose String if the value is a text field, or choose Date if the value is a date field.
NOTE The String and Date field types should be the only field types you use.
-
In the Formula field, type the formula for the calculated field.
-
Use a Calculated Field in the Report
To add a calculated field to your report, select the field in the Calculated fields list and drag it onto the area of the report where you want it to display.
The calculated field displays in the DataField property.
The Calculated Field Used for a Field
Using Calculated Fields to Display a Message if a Field Has No Value
Many times you will want to display a field on your report, but if no value exists for that field, display a message like “No information found.” For example, if there is a value in the Related_Contacts_Name field, then display it. Otherwise, display “No information found.”
In a scenario like this, you to not have to create an If Statement. You can use the DefaultValue and Formula properties in a calculated field to display the information you want.
In your use, replace Related_Contacts_Name with the field value to display, and replace DefaultValue with the text to display if no value exists for that field.