Hi,
I’m integrating testrail to the eazyBi using Rest API, and I’m a bit stuck with adding multi-value dimension.
Original field example: device_types: [1, 2, 3]
I’ve mapped its ids and transformed them into string, resulting in:
device_types_mapped: “Item 1, Item 2, Item 3”
For my report, I need to have the ability to calculate a number of cases that have specific device type (e.g.: “Item 2”), but the problem is that in generated dimension, I can select only the entire string like “Item 1, Item 2, Item 3”.
Here is my javascript for the specified field:
{
"name": "custom_device_types_string",
"data_type": "string",
"source_column_name": "(internal)",
"javascript_code": "multiple_values = true;\nsplit_by = \",\";\ndata_type = \"String\";\ndimension = true;\n\nfunction getDeviceType(integer) {\n switch (integer) {\n case 1:\n return \"Item 1\";\n case 2:\n return \"Item 2\";\n case 3:\n return \"Item 3\";\n case 4:\n return \"Item 4\";\n default:\n return \"Unknown\";\n }\n};\nif (doc.custom_dpd_device_type) {\n return doc.custom_dpd_device_type.map(getDeviceType).join(', ');\n}\nelse {\n return \"\";\n}",
"dimension": "Device Type",
"dimension_level": ""
}
Unlike in the Jira source, there are no advanced settings during import, and adding multiple_values = true in javascript does nothing. Is there another way to do it in Rest API import?
Will appreciate any help!