> ## Documentation Index
> Fetch the complete documentation index at: https://help.dingtalk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Handle Returned Data

> This page explains how to process the data returned by an API, with a focus on conditional evaluation and transformation of specific numerical values. The example shows how to return either 0 or 100 based on the data value, along with the corresponding JavaScript implementation.

In this function, you can process the data returned by the API. Click the button to see the initial function body as shown below. The first parameter `data` is the returned data. Write JavaScript to process `data` and return the result.

**Example:**

Suppose the API returns the data below. You need to process the Numerical column: return 0 when the value is less than or equal to 0, and return 100 when the value is greater than 0.

First, examine the data section of the API. `data` is an array. The example below contains 4 items, corresponding to 4 records in the Spreadsheet. Each item contains 2 data values, corresponding to the 2 data values in each record. Next, determine which of the 2 values corresponds to the Numerical field. In this example, since the data formats of the Numerical field and the Modified time field are clearly different, you can tell at a glance that **field\_kr1zcs45 corresponds to the Numerical field, and field\_kr1zcs49 corresponds to the day\_Modified time**. If the dataset is large and hard to identify at a glance, analyze it using the `meta` field. Locate the item whose `aliasName` contains "Numerical"; its `fieldId` is **field\_kr1zcs45**.

Finally, process the data.

```javascript theme={"theme":{"light":"github-light","dark":"github-dark"}}
/**
* Apply custom processing to the returned data
* Returned data reference: https://www.yuque.com/yida/support/xgg4ps
* data: the returned data
* extraInfo: { meta: [], cardParams: {} }, where meta is the data metadata and cardParams is the Card parameter information
*/
function afterFetch(data, extraInfo) {
  data.forEach(item => {
    // Check whether the value is greater than 0
    if (item['field_kr1zcs45'] > 0) {
      // If greater than 0, set it to 100
      item['field_kr1zcs45'] = 100;
    } else {
      // Otherwise, set it to 0
      item['field_kr1zcs45'] = 0;
    }
  });
  return data;
}
```
