Custom Syntax for Clio and CSV Variables
You can perform logic and calculations with Clio and CSV variables just as you can with regular variables.
Calculations
Because Clio and CSV variables are passed into Gavel as text (as opposed to formatted numbers), we need to add formatting to turn those variables into numbers/integers.
For example, 10,000 will be transmitted to Gavel as 10000. So, to render it as differently, you can add formatting as follows. You will insert the variable (without the brackets) into the following formats:
Currency:
Wrap just the Clio field with the currency format:
{{ currency(ClioVariable["client"].salary) }}
Calculation:
Wrap the Clio field with (ClioVariable)|int (which tells Gavel to turn it into an integer), and then add your equation. For example, in the equation below, you are dividing the Clio Matter field for "salary" by 40:
{{ (ClioVariable["client"].salary|int)/40 }}
Dates
Clio date variables are also passed into Gavel as text, so you will need to turn them into dates by using the syntax below:
{{ as_datetime(ClioVariable["date"]).strftime("%B %d, %Y") }}
Here's how you would write the DDth day of MMMM, YYYY:
the {{ ordinal_number(as_datetime(ClioVariable["date"]).strftime("%d"), use_word=False) }}{{ as_datetime(ClioVariable["date"]).strftime(" day of %B, %Y") }}
Logic
Conditional logic:
You can add logic based on Clio variables in the same way as regular variables. For example, the following sets conditional logic based on whether the custom field "maritalstatus" has the value "Married."
{% if ClioVariable["custom_fields"].maritalstatus == "Married" %}The client is married.{% endif %}
Logic to determine if a Clio field is not blank:If you want text to appear if a Clio field is not blank, you will simply write "if variablename..." as follows:
{% if ClioVariable["client"].firstname %} Conditional text if not blank.{% endif %}"