Jump to content

Formatting in calculated field breaks calculation


Recommended Posts

I have a calculated field in a report datapage that has a simple if/then statement.  The calculated field is working fine, but when I apply a custom format for Yes/No to make No's show up as Red text, the calculated field no longer works.  I am not sure if this is something I will need to do with Javascript instead of formatting.

The calculated field does this:

CASE
WHEN [@field:Q17]=0 THEN 'No'

WHEN [@field:Q17]=1 THEN 'Yes'

 ELSE 'N/A'
END

When I apply the formatting and the records have null values (should be showing N/A), all of the values in the calculated field change to be 'Yes'.

I want to change any 'No' text in this column to be red, all other text options should stay black.

Thank you,

Phil

Link to comment
Share on other sites

Hello Phil,

 

I have noticed that you have three possible values which can be assigned to the Calculated field which causes an error.

You should specify only two values such as Yes/No or True/False in order to apply the Localization formatting Yes/No. 

You may use Formula field if you prefer to leave three options within your Case statement. 

Formula field Case expression should consist of HTML elements in order to change the color of assigned value: 

CASE

WHEN [@field:Q17]=0 THEN '<span style="color:#FF0000;">No</span>'

WHEN [@field:Q17]=1 THEN 'Yes'

 ELSE 'N/A'

END

You should enable HTML on Datapage by selecting "Render value as: HTML" and you can also insert formula field as HTML parameter in HTML block.

Screenshot.JPG

Hope this helps.

 

Regards,

vitalikssssss

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...