# Scripted fields in canvas

**URL:** <https://discuss.elastic.co/t/scripted-fields-in-canvas/159909>\
**Category:** Kibana\
**Created:** [December 7, 2018, 10:35am UTC](https://discuss.elastic.co/t/scripted-fields-in-canvas/159909 "2018-12-07T10:35:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hashitha](https://avatars.discourse-cdn.com/v4/letter/h/ce73a5/32.png) [@hashitha](https://discuss.elastic.co/u/hashitha)\
**Post date:** [December 7, 2018, 10:35am UTC](https://discuss.elastic.co/t/scripted-fields-in-canvas/159909/1 "2018-12-07T10:35:56Z")

</div>

I have created a scripted field to calculate the total based on items in an array in the document

```
int total= 0; 
for(int i = 0; i < params._source['ServiceItemList'].size(); i++) { 
    total+= params._source['ServiceItemList'][i].Fee; 
}
return total/100;

```

The document is something like this

```
{
    "Patient":"John Doe",
    "Clinic":"ACME",
    "BillingType": "Private",
    "ServiceItemList": [
      {
        "ItemNo": "5555",
        "Fee": 10910,
        "ShortDescription": "Ultrasound MSK"
      },
      {     
        "ItemNo": "1111",
        "Fee": 8555, 
        "ShortDescription": "Consultation"
      }
    ]
}

```

The scripted field works fine in the dashboards but doesn't work when I try on Canvas, It says unknown column.

Are scripted fields supported in canvas? if not is there another way I can draw a table with two columns Patient name and Total in canvas

---

<div class="post-metadata">

**Author:** ![cjcenizal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cjcenizal/32/11216_2.png) [@cjcenizal](https://discuss.elastic.co/u/cjcenizal)\
**Post date:** [December 7, 2018, 10:56pm UTC](https://discuss.elastic.co/t/scripted-fields-in-canvas/159909/2 "2018-12-07T22:56:12Z")

</div>

Hi there, unfortunately Canvas doesn't currently support scripted fields. Please feel free to open a [feature request](https://github.com/elastic/kibana/issues/new?template=Feature_request.md).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 4, 2019, 10:56pm UTC](https://discuss.elastic.co/t/scripted-fields-in-canvas/159909/3 "2019-01-04T22:56:14Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
