Hi @Krisseliine_Part,
A warm welcome to the eazyBI community
!
You are correct. The parameter check_calculated_value = true
doesn’t work for JavaScript calculated custom fields.
An approach I can think of right now is importing all the comments with HTML formatting placeholders for each comment. For example, each separate comment is inside its own <p></p>
tags. The imported comment property then could return results similar to the one below in plain text:
<p>Curabitur blandit tempus ardua ridiculus sed magna.</p>
<p>Magna pars studiorum, prodita quaerimus.</p>
<p>Curabitur blandit tempus ardua ridiculus sed magna.</p>
Next, import the last commend date as a JavaScript calculated custom field. See an example here - JavaScript calculated custom fields.
Now you can define a new calculated measure that will compare the last comment date to the current date and color the last comment accordingly with HTML style
element. See the suggested formula below:
CASE WHEN
NOT IsEmpty([Measures].[Issue All comments])
AND
-- how old in days is the comment?
DateDiffDays(
[Measures].[Issue Last Comment Date],
'now'
) < 2
THEN
-- replace the last line/comment with the comment wrapped in a <span> element and color it green
Replace(
[Measures].[Issue All comments],
-- find the last line (comment)
ExtractString(
[Measures].[Issue All comments],
'.*</p>\z',
0
),
-- wrap the last line/comment within a <span> element and color it
'<span style="color:green">'||
ExtractString(
-- find last line
[Measures].[Issue All comments],
'.*</p>\z',
0
)
)
ELSE
-- replace the last line/comment with the comment wrapped in a <span> element and color it red
Replace(
[Measures].[Issue All comments],
ExtractString(
-- find last line
[Measures].[Issue All comments],
'.*</p>\z',
0
),
'<span style="color:red">'||
ExtractString(
-- find last line
[Measures].[Issue All comments],
'.*</p>\z',
0
)
)
END
Update the formula to consider the correct issue properties and duration in days from the last comment date. Use the “HTML” formatting option for the calculated measure. Please see an example below with the two JavaScript calculated properties and the calculated measure:
Best,
Roberts // support@eazybi.com