# Javascript-calculated-custom-fields dimension

**URL:** <https://community.eazybi.com/t/javascript-calculated-custom-fields-dimension/8513>\
**Category:** Questions & Answers\
**Tags:** javascript, jira\
**Created:** [December 23, 2021, 8:46am UTC](https://community.eazybi.com/t/javascript-calculated-custom-fields-dimension/8513 "2021-12-23T08:46:52Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![nadir](https://community.eazybi.com/letter_avatar_proxy/v4/letter/n/e5b9ba/32.png) [@nadir](https://community.eazybi.com/u/nadir)\
**Post date:** [December 23, 2021, 8:46am UTC](https://community.eazybi.com/t/javascript-calculated-custom-fields-dimension/8513/1 "2021-12-23T08:46:52Z")

</div>

Hi,

I want to add a custom measure from a idalko grid which refereed to a multiple dimensions of column grid

multiple\_dimensions=[" cutomfield\_col1", “cutomfield\_col2”,“cutomfield\_col3”]

and each dimension is configured like this

[jira.customfield\_col1]  
name = “Col1”  
data\_type = “string”  
dimension = true  
multiple\_values = true  
separate\_table=true  
split\_by = “,”

regards,

---

<div class="post-metadata">

**Author:** ![lauma.cirule](https://community.eazybi.com/user_avatar/community.eazybi.com/lauma.cirule/32/8830_2.png) [@lauma.cirule](https://community.eazybi.com/u/lauma.cirule)\
**Post date:** [December 23, 2021, 1:44pm UTC](https://community.eazybi.com/t/javascript-calculated-custom-fields-dimension/8513/2 "2021-12-23T13:44:24Z")

</div>

Hi @nadir!

eazyBI does not have an integration with the iDalko Table Grid Editor custom fields. Nevertheless, there are workarounds on how to import values from the table in the custom field to eazyBI. Please see a similar community request here: [How to get table grid editor data in separate lines](https://community.eazybi.com/t/how-to-get-table-grid-editor-data-in-separate-lines/4195).

Lauma / [support@eazybi.com](mailto:support@eazybi.com)

---

<div class="post-metadata">

**Author:** ![nadir](https://community.eazybi.com/letter_avatar_proxy/v4/letter/n/e5b9ba/32.png) [@nadir](https://community.eazybi.com/u/nadir)\
**Post date:** [December 23, 2021, 2:17pm UTC](https://community.eazybi.com/t/javascript-calculated-custom-fields-dimension/8513/3 "2021-12-23T14:17:38Z")

</div>

Thanks  
I had do it, it works fine for dimensions but not for measure

---

<div class="post-metadata">

**Author:** ![lauma.cirule](https://community.eazybi.com/user_avatar/community.eazybi.com/lauma.cirule/32/8830_2.png) [@lauma.cirule](https://community.eazybi.com/u/lauma.cirule)\
**Post date:** [December 23, 2021, 2:42pm UTC](https://community.eazybi.com/t/javascript-calculated-custom-fields-dimension/8513/4 "2021-12-23T14:42:23Z")

</div>

@nadir,

If you have the dimensions specified, you can fill in values as well as map measure to them in the following way.

Please note that the dimensions must be single value and with a separate table to be able to map values to them:

```xml
[jira.customfield_col1]
name = "Col1"
data_type = "string"
dimension = true
separate_table = true

```

And the further measure adding would be as follows:

```xml
[jira.customfield_tbl_measure]
name = "Tbl Measure"
data_type = "decimal"
measure = true
multiple_dimensions = ["Col1"]
javascript_code = '''
getDocument("/rest/idalko-igrid/1.0/grid/AAAAA/issue/" + issue.id, {ignoreErrors: [404,400]}, 
 function(result){
 resultArray = [];
  if (result && result.values) {
    result.values.forEach(function(valuesItem){  
      resultArray.push([
        valuesItem.icol1, 
        valuesItem.imeasure
      ]);
    })
  }
issue.fields.customfield_tbl_measure = resultArray.join("\n");
});
'''

```

Lauma / [support@eazybi.com](mailto:support@eazybi.com)

---

<div class="post-metadata">

**Author:** ![nadir](https://community.eazybi.com/letter_avatar_proxy/v4/letter/n/e5b9ba/32.png) [@nadir](https://community.eazybi.com/u/nadir)\
**Post date:** [December 23, 2021, 2:54pm UTC](https://community.eazybi.com/t/javascript-calculated-custom-fields-dimension/8513/5 "2021-12-23T14:54:25Z")

</div>

It support just dimensions with single value  
In my case , my dimensions are multiple values  
for example in my grid i  
can have this mines  
dim1 val1 dim2 val1 dim3 val1 measure value  
dim1 val2 dim2 val2 dim3 val2 measure value  
…

---

<div class="post-metadata">

**Author:** ![lauma.cirule](https://community.eazybi.com/user_avatar/community.eazybi.com/lauma.cirule/32/8830_2.png) [@lauma.cirule](https://community.eazybi.com/u/lauma.cirule)\
**Post date:** [December 29, 2021, 8:51am UTC](https://community.eazybi.com/t/javascript-calculated-custom-fields-dimension/8513/6 "2021-12-29T08:51:45Z")

</div>

Hi @nadir,

Yes, you can import additional measures or properties only to the custom field dimensions that are single-value. In most cases, it is possible to configure the dimensions in such a way. From the theoretical example you gave, I also do not see why they should be multiple values. The result in eazyBI would be something like this:

```xml
| dim1 | dim2 | measure |
| val1 | val1 | 10 |
| val2 | val2 | 15 |

```

Could you please share more details of your business case with a table grid screenshot - which columns you wish to import as dimensions and what values would you like to import as measures? You can send it over to [support@eazybi.com](mailto:support@eazybi.com), mentioning this community post.

Lauma / [support@eazybi.com](mailto:support@eazybi.com)

---

<div class="post-metadata">

**Author:** ![nadir](https://community.eazybi.com/letter_avatar_proxy/v4/letter/n/e5b9ba/32.png) [@nadir](https://community.eazybi.com/u/nadir)\
**Post date:** [December 29, 2021, 2:11pm UTC](https://community.eazybi.com/t/javascript-calculated-custom-fields-dimension/8513/7 "2021-12-29T14:11:38Z")

</div>

Hi,  
Thanks for replying  
Blow a table example

 ![image](https://community.eazybi.com/uploads/default/original/2X/4/499e1b260c565b5889aacd918dc4b6b6233f7c93.png)

- Each issue has a table like this
- this table has at least one line.
- DIM 1 , DIM2 and DIM 3 are selection list  
Reagrds

---

<div class="post-metadata">

**Author:** ![lauma.cirule](https://community.eazybi.com/user_avatar/community.eazybi.com/lauma.cirule/32/8830_2.png) [@lauma.cirule](https://community.eazybi.com/u/lauma.cirule)\
**Post date:** [January 5, 2022, 9:01am UTC](https://community.eazybi.com/t/javascript-calculated-custom-fields-dimension/8513/8 "2022-01-05T09:01:54Z")

</div>

@nadir,

For this setup, the [suggestion I posted above](https://community.eazybi.com/t/javascript-calculated-custom-fields-dimension/8513/4) should work (be aware of the naming for dimensions and table grid configuration).  
Please try this and let me know how far you get; you may send exact steps to [support@eazybi.com](mailto:support@eazybi.com) if that would be easier to debug.

Lauma / [support@eazybi.com](mailto:support@eazybi.com)

---

<div class="post-metadata">

**Author:** ![nadir](https://community.eazybi.com/letter_avatar_proxy/v4/letter/n/e5b9ba/32.png) [@nadir](https://community.eazybi.com/u/nadir)\
**Post date:** [January 5, 2022, 9:24am UTC](https://community.eazybi.com/t/javascript-calculated-custom-fields-dimension/8513/9 "2022-01-05T09:24:59Z")

</div>

@lauma.cirule  
Thanks for your replying, i have resolved it by developing rest api.  
I think the problem is multiple values  
I had tried it , but not working in eazy BI : 5.3.0.  
Below the configurations:  
Dimensions:

[jira.customfield\_dim1]  
name = “DIM1”  
data\_type = “string”  
dimension = true  
multiple\_values = true  
separate\_table = true  
split\_by = “,”  
javascript\_code = ‘’’  
getDocument("/rest/idalko-igrid/1.0/grid/AAAA/issue/" + issue.id, {ignoreErrors: [404,400]},  
function(result){  
resultArray = [];  
if (result && result.values) {  
result.values.forEach(function(valuesItem){  
resultArray.push(  
valuesItem.dim1  
);  
})  
}  
issue.fields.customfield\_dim1= resultArray.toString();  
});  
‘’’  
[jira.customfield\_dim2]  
name = “DIM2”  
data\_type = “string”  
dimension = true  
separate\_table = true  
multiple\_values = true  
split\_by = “,”  
javascript\_code = ‘’’  
getDocument("/rest/idalko-igrid/1.0/grid/AAAA/issue/" + issue.id, {ignoreErrors: [404,400]},  
function(result){  
resultArray = [];  
if (result && result.values) {  
result.values.forEach(function(valuesItem){  
resultArray.push(  
valuesItem.dim2  
);  
})  
}  
issue.fields.customfield\_dim1= resultArray.toString();  
});  
‘’’

[jira.customfield\_dim3]  
name = “DIM3”  
data\_type = “string”  
dimension = true  
separate\_table = true  
multiple\_values = true  
split\_by = “,”  
javascript\_code = ‘’’  
getDocument("/rest/idalko-igrid/1.0/grid/AAAA/issue/" + issue.id, {ignoreErrors: [404,400]},  
function(result){  
resultArray = [];  
if (result && result.values) {  
result.values.forEach(function(valuesItem){  
resultArray.push(  
valuesItem.dim3  
);  
})  
}  
issue.fields.customfield\_dim1= resultArray.toString();  
});  
‘’’  
Measure:  
[jira.customfield\_tbl\_measure]  
name = “Tbl Measure”  
data\_type = “decimal”  
measure = true  
multiple\_dimensions = [“DIM1”,“DIM2”,“DIM3”]  
javascript\_code = ‘’’  
getDocument("/rest/idalko-igrid/1.0/grid/AAAAA/issue/" + issue.id, {ignoreErrors: [404,400]},  
function(result){  
resultArray = [];  
if (result && result.values) {  
result.values.forEach(function(valuesItem){  
resultArray.push([  
valuesItem.dim1,  
valuesItem.dim2,  
valuesItem.dim3,  
valuesItem.imeasure  
]);  
})  
}  
issue.fields.customfield\_tbl\_measure = resultArray.join("\n");  
});  
‘’’  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![lauma.cirule](https://community.eazybi.com/user_avatar/community.eazybi.com/lauma.cirule/32/8830_2.png) [@lauma.cirule](https://community.eazybi.com/u/lauma.cirule)\
**Post date:** [January 5, 2022, 10:06am UTC](https://community.eazybi.com/t/javascript-calculated-custom-fields-dimension/8513/10 "2022-01-05T10:06:34Z")

</div>

@nadir,

As noted, the `multiple_values` setting will not work for this scenario, but it is also not necessary.  
Please unselect all the fields from import and run the import without them deleting any configuration.  
Further, please try the following settings, and after that, rerun the import.

```auto
[jira.customfield_dim1]
name = “DIM1”
data_type = “string”
dimension = true
separate_table = true

[jira.customfield_dim2]
name = “DIM2”
data_type = “string”
dimension = true
multiple_values = true

[jira.customfield_dim3]
name = “DIM3”
data_type = “string”
dimension = true
separate_table = true

[jira.customfield_tbl_measure]
name = “Tbl Measure”
data_type = “decimal”
measure = true
multiple_dimensions = [“DIM1”,“DIM2”,“DIM3”]
javascript_code = '''
getDocument("/rest/idalko-igrid/1.0/grid/AAAAA/issue/" + issue.id, {ignoreErrors: [404,400]},
function(result){
resultArray = [];
if (result && result.values) {
result.values.forEach(function(valuesItem){
resultArray.push([
valuesItem.dim1,
valuesItem.dim2,
valuesItem.dim3,
valuesItem.imeasure
]);
})
}
issue.fields.customfield_tbl_measure = resultArray.join("\n");
});
'''

```

Lauma / [support@eazybi.com](mailto:support@eazybi.com)

---

<div class="post-metadata">

**Author:** ![nadir](https://community.eazybi.com/letter_avatar_proxy/v4/letter/n/e5b9ba/32.png) [@nadir](https://community.eazybi.com/u/nadir)\
**Post date:** [January 5, 2022, 10:39am UTC](https://community.eazybi.com/t/javascript-calculated-custom-fields-dimension/8513/11 "2022-01-05T10:39:18Z")

</div>

@lauma.cirule  
Thanks, it is working now  
Just i want to add time as a dimension too, is it possible?

---

<div class="post-metadata">

**Author:** ![lauma.cirule](https://community.eazybi.com/user_avatar/community.eazybi.com/lauma.cirule/32/8830_2.png) [@lauma.cirule](https://community.eazybi.com/u/lauma.cirule)\
**Post date:** [January 5, 2022, 11:05am UTC](https://community.eazybi.com/t/javascript-calculated-custom-fields-dimension/8513/12 "2022-01-05T11:05:40Z")

</div>

@nadir,

Great!

Yes, **Time** can also be one of the `multiple_dimensions` to which you associate the measure value. Only you need to specify what that date is and write it in the correct place (note how all values are in the order of dimensions in the `multiple_dimensions` setting) and [format](https://docs.eazybi.com/eazybi/data-import/external-data-sources/data-mapping#Datamapping-Rule#2%E2%80%93OnlyOneTimeDimension).

See an example with Time used, here: [JavaScript calculated custom fields](https://docs.eazybi.com/eazybi/data-import/data-from-jira/jira-custom-fields/javascript-calculated-custom-fields#JavaScriptcalculatedcustomfields-DaysforAssignee).

Lauma / [support@eazybi.com](mailto:support@eazybi.com)

---

<div class="post-metadata">

**Author:** ![nadir](https://community.eazybi.com/letter_avatar_proxy/v4/letter/n/e5b9ba/32.png) [@nadir](https://community.eazybi.com/u/nadir)\
**Post date:** [January 5, 2022, 1:35pm UTC](https://community.eazybi.com/t/javascript-calculated-custom-fields-dimension/8513/13 "2022-01-05T13:35:37Z")

</div>

@lauma.cirule Thanks so much for your support
