> For the complete documentation index, see [llms.txt](https://docs.kasko.io/kasko-frontend-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kasko.io/kasko-frontend-documentation/getting-started/manifest-computed-values.md).

# Defining computed values

Each app can have some specific data transformations needed. Now this can be done via building service that handles this in js, but often times transformation is simple enough that it is easier to define it as a computed value in manifest.

## Usage

In root level of the manifest, inside `config` section, we can define `computed_values` object.

Example:

```js
{
  "config": {
    // ...
    "computed_values": {
      "policy_start_date": {
        "value": {
          "type": "jsonlogic",
          "schema": {
            "var": "active_policy.quote.customer_input.start_date"
          }
        }
      }
    }
  }
}
```

In this example input value `policy_start_date` will be updated whenever value `active_policy.quote.customer_input.start_date` changes with the value it changed to.

### update\_when\_changes

There are some cases where we don't want to update value when it changes. In those cases we can define dependency logic in `update_when_changes` that will handle change detecton instead of `value`.

Example:

```js
{
  "config": {
    // ...
    "computed_values": {
      "data.agents_count": {
        "value": {
          "type": "jsonlogic",
          "schema": {
            "+": [
              {
                "length": {
                  "var": "input.data.agents"
                }
              },
              {
                "var": "input.data.additional_count"
              }
            ]
          }
        },
        "update_when_changes": {
          "type": "jsonlogic",
          "schema": {
            "var": "input.data.additional_count"
          }
        }
      }
    }
  }
}
```

In this example `data.agents_count` input value will only update when `input.data.additional_count` value changes. This would improve performance if `input.data.agents` is static value and we don't want to listen for changes in there.

### skip\_form

All of the computed values will automatically update `input` and `form` state. By adding `skip_form` property we can set this value to be only sent to `input`.

Example:

```js
{
  "config": {
    // ...
    "computed_values": {
      "hello": {
        "value": {
          "type": "jsonlogic",
          "schema": "Hello world"
        },
        "skip_form": true
      }
    }
  }
}
```

In this example `hello` value will only be set in `input` state and not `form`. Meaning this will not update field values in current screen without `watch_changes` enabled on form.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.kasko.io/kasko-frontend-documentation/getting-started/manifest-computed-values.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
