Javascript-calculated-custom-fields dimension

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,

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.

Lauma / support@eazybi.com

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

@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:

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

And the further measure adding would be as follows:

[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

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

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:

| 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, mentioning this community post.

Lauma / support@eazybi.com

Hi,
Thanks for replying
Blow a table example

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

@nadir,

For this setup, the suggestion I posted above 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 if that would be easier to debug.

Lauma / support@eazybi.com

@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

@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.

[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

1 Like

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

@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.

See an example with Time used, here: JavaScript calculated custom fields.

Lauma / support@eazybi.com

1 Like

@lauma.cirule Thanks so much for your support

1 Like