Click the Create Formula button to start a formula
Fill in the name for the formula
Pick the field that will receive the result of the formula
Make sure the Active check box is checked
Set the order applied. This is what order the formula is executed in.
When set to true this will skip math formula when the results field contains data
Select the table the field will come from
Select the type of field
Add the field by double clicking the name or highlighting the field and clicking the Add Selected Field as Cursor button
Add any operative signs ex (+, -, /, *)
Click the OK button when done
The buttons at the bottom of the screen will add in generic snippets of code to help you get started.
If/Else: gets you started comparing different fields replace field_a and field_b with the field names to compare
Date Difference: will return the difference between two dates
Replace Fields: replace a field in the database with a field passed to the math formula
Parameters: Shows the parameters passed by the form and that can be accessed in the math formula
If/Else Date: gets you started comparing two dates
Line Numbers will put line numbers in the text area
'-----------------------------------------------------------------------
' This math function automates the ID/Status field based on attached opportunities
' You could set the math function to 'Run on schedule' say at 2am every night
'-----------------------------------------------------------------------
try '----------------------------------------------------------------------- ' Does the contact have ANY opportunities? ' If there is more then Zeror set the ID/Status field to CUSTOMER '----------------------------------------------------------------------- if HostApplication.ApplicationState.CurrentContact.GetOpportunities(nothing, nothing).Count > 0 Return "Customer" else Return nothing ' Returing nothing causes no change to the 'Result Field' end if
catch ex as exception ' Something went wrong - display a message to the end user System.Windows.Forms.Messagebox.show(ex.message)
end try