The Rich Text Control displays the contents of ACT! memo fields preserving font sizes and font characteristcs. You can also merge other fields into the RTF control to create paragraphs. Here is an example.
"Dear [CONTACT.FIRST_NAME] [CONTACT.LAST_NAME],
Your Bonding amount is [CONTACT.Bonding Amount].
Thank you.
The management."
It CAN NOT perform complex expression. You CAN NOT do something like this" "Dear [CONTACT.FIRST_NAME] [CONTACT.LAST_NAME],
Your Bonding amount is IIF([CONTACT.Bonding Amount]>0,[CONTACT.Bonding Amount], "$_____________")
Thank you.
The management."
Now to the good news!
You can do conditional expression in a calculated field then merge the results back into the RTF control. "Dear [CONTACT.FIRST_NAME] [CONTACT.LAST_NAME],
Your Bonding amount is [CONTACT.calc_amount]. Thank you
Thank you.
The management."
Here are the steps to create a conditional calculated field. There is also an example report you can download at the bottom of this page.
1. Open the Report
2. Click on the SCRIPT icon on the ribbon This will open the script page in the designer
3. Enter the sub routine which will perform the calculation Most users place this at the bottom of any existing script.
Private Sub calc_amount_GetValue(ByVal sender As Object, ByVal e As DevExpress.XtraReports.UI.GetValueEventArgs)
'------------------------------------
' We need to always check for NULL
'------------------------------------
IF e.Row.item("Bonding Amount") IS System.DBNULL.Value
'------------------------------------
' YES its null then just return the underline
'------------------------------------
e.value = "$_________________"
ELSE
'------------------------------------
' Check if the amount is greater then zero
'------------------------------------
IF e.Row.item("Bonding Amount") > 0
'------------------------------------
' Amount is greater then zero!
' Set the e.value as currency
' from the "Bonding Amount" value
' of the current record
'------------------------------------
e.value = String.Format( "{0:c2}", e.Row.item("Bonding Amount"))
ELSE
'------------------------------------
' The value is Zero then just return the underline
'------------------------------------
e.value = "$_________________"
END IF
END IF
End Sub
4. Click on the DESIGNER icon on the ribbon You are now back on the columns layout. You need to add a calculations field which will run the script above. In order to do this we now need to add the field into our existing field list/
5. Click on the CALCULATION icon on the ribbon. The window below will open. a - Click on the [+] sign next to SCRIPTS to expand. b - Click on the down arrow next to GET A VALUE and select the function name. Here we select "calc_amount_GetValue"
c - Click on the drop down arrow in the DATA MEMBER to select your table name. In this example its "CONTACT"
d- Change the name from the non descript "calculatedField1" to "calc_amount" e- Click OK to close the window.
NOTE you may need to re-select the DESIGNER icon on the ribbon if you are viewing the script.
6. You will now have a new field in your field list named "calc_amount"
7. You can now drag this field onto the report or into an RTF control
Here what is will look like in the designer
Here's what it looks like printed:
We have attached the example report to download. To download and import into your designer follow these steps:
1. Using the link below download the zip file onto your PC
2. In Impact Report Designer click on the IMPORT icon on the toolbar.
3. Select the downloaded ZIP file and click OK.
4. Place a check mark in the example report and click INSTALL.