# Updates to Calculation's Syntax

Created on 2020-06-23

We have updated the calculation's syntax for filtering and accessing values on Risk Queries. In this document, I will explain the changes and provide examples on how to use the new syntax.

It's important to note that all your calculations have automatically been updated to use the new syntax. Additionally, we have updated the BriteLines documentation to reflect the changes, you will find more examples there.

# Item's Term Premium

We have made changes to the syntax for:

  1. Filtering Risks by an Item's Term Premium.
  2. Accessing an Item's Term Premium on an aggregated query (min, max, sum, etc.).

# Filtering

Before:

items__towing__premium
1

Now:

items__towing__premium__term__value
1

# Example

Here is an example calculation that retrieves Risks where the bodilyInjury Item's Term Premium is greater than 1:

bc.risk.children.filter(items__bodilyInjury__premium__term__value__gt=1)
1

# Accessing

Before:

items.bodilyInjury.premium
1

Now:

bc.items.bodilyInjury.premium.term.value
1

# Example

Here is an example calculation that retrieves the sum of the bodilyInjury Item's Term Premium for all the children Risks:

bc.risk.children.sum(bc.items.bodilyInjury.premium.term.value)
1

# Fields

We have made changes to the syntax for:

  1. Filtering Risks by a Field's value
  2. Accessing a Field's value on an aggregated query (min, max, sum, etc.).

# Filtering

Before:

field_answers__mileage
1

Now:

fields__mileage
1

# Example

Here is an example calculation that retrieves all the Risks where the mileage Field value is greater than 1000:

bc.risk.children.filter(fields__mileage__gt=1000)
1

# Accessing

Before:

field_answers.mileage
1

Now:

bc.fields.mileage
1

# Example

Here is an example calculation that retrieves the minimum mileage Field value for all the Risks on the Policy:

bc.risk.children.min(bc.fields.mileage)
1

# Rate Tables

We have made changes to the syntax for accessing a Rate Table's resolution value on an aggregated query.

Before:

rate_tables.collisionBaseRateTable
1

Now:

bc.rate_tables.collisionBaseRateTable
1

# Example

Here is an example calculation that retrieves the sum of all the children Risks collisionBaseRateTable resolution value:

bc.risk.children.sum(bc.rate_tables.collisionBaseRateTable)
1

# Risk Term Premium

We have made changes to the syntax for:

  1. Filtering Risks by their Term Premium on a Risk Query.
  2. Accessing a Risk's Term Premium.

# Filtering

Before:

total_premium
1

Now:

premium__term__value
1

# Example

Here is a calculation example that retrieves all the risks where the Term Premium is greater than 1:

bc.risk.children.filter(premium__term__value__gt=1)
1

# Accessing

Before:

bc.risk.total_premium
1

Now:

bc.risk.term_premium
1