> For the complete documentation index, see [llms.txt](https://docs.coherent.global/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coherent.global/build-spark-services/additional-mappings/sub-functions-with-subservices.md).

# Sub functions with subservices

Syntax: `Xinput_<subservice>.<parameter>` and `Xoutput_<subservice>.<parameter>`

You can separate different groups of calculations into sub functions known as subservices. This is powerful because a Spark service can now perform multiple separate calculations through the same integration.

## Sample file

{% file src="/files/IiPb8UFQqOATR1g5TqyX" %}

| PRODUCT subservice&#xA;result = PRODUCT(a, b) | SUM subservice&#xA;result= SUM(c, d) |
| --------------------------------------------- | ------------------------------------ |
| `Xinput_product.a`                            | `Xinput_sum.c`                       |
| `Xinput_product.b`                            | `Xinput_sum.d`                       |
| `Xoutput_product.result`                      | `Xoutput_sum.result`                 |

## Submit API requests for subservices in the API Tester

1. In the [API Tester](/navigation/api-tester.md#customize-the-request), there is a dropdown for **Subservices.**
   * If a Spark service has subservices, a dropdown is visible with **Default** as the default value. Inputs and outputs not mapped to a subservice are assigned to the **Default** subservice.
2. Use the dropdown to select which subservices to include in the API call. The  [Execute API (v3)](/spark-apis/execute-api/execute-api-v3.md#request_meta) parameter `service_category`  will be updated.
3. Spark filters the displayed inputs and outputs based on the selected subservices.
4. Make changes to the inputs.
5. **Submit** the API call.
6. Note that the response will only contain the outputs for the selected subservice(s).

## Metadata subservice

Syntax: `Xoutput_metadata.<parameter>`

Use the metadata subservice together with the [Metadata APIs](/spark-apis/metadata-api.md) for static data that doesn't change when inputs change. This subservice is much faster than using the full [Execute API](/spark-apis/execute-api.md), since it does not perform any calculations.

The metadata outputs should only contain static data.

* If the metadata output contains a formula, Spark will evaluate it upon upload and save the value.
* However, any other subservices that depend on cells marked as metadata will still evaluate the underlying formula.
