NeoInJS Posted March 29, 2017 Report Share Posted March 29, 2017 Hello - I have a field name with Data type Yes/No and in my tabular report, instead of displaying the value I want to show a Check mark imgae if the value is 'Yes' and an X mark if the value is NO. I was thinking of using a formula field. is this possible? Or is there any work around? Thank you. Quote Link to comment Share on other sites More sharing options...
nightowl Posted March 29, 2017 Report Share Posted March 29, 2017 Hi NeoJS, This can be possible using formula fields. However, the generated <img> element for the custom checkbox renders as text in tabular reports, due to an HTML encoding issue. The workaround is to use some script inside an HTML block to fix the encoding of the formula field result. The entire solution for this forum post is as follows: Create a Yes/No field in the table if there's none yet. In this example, I created a Yes/No field called Status. Create a formula field that will generate the image tag based on the checkbox value. In this example, I created a formula field called Checkbox_Image. Put this formula inside the formula field: CASE WHEN [@field:Status] = 1 THEN '<img src="FULL_URL_OF_CHECK_MARK" />' ELSE '<img src="FULL_URL_OF_X_MARK" />' END You cannot do something like <img src="[@field:My_Image_Field]"> inside the formula. That is, you cannot insert or use other fields as the image source URL. Then, on the tabular report, create an HTML block in the results page. Don't add the default Checkbox_Image field. Then, with the Source button enabled, paste this custom script there: <script> var imageLink = "[@field:Checkbox_Image]"; imageLink = imageLink.replace(new RegExp("<", 'gi'), "<"); imageLink = imageLink.replace(new RegExp(">", 'gi'), ">"); imageLink = imageLink.replace(new RegExp(""", 'gi'), '"'); console.log(imageLink); document.write(imageLink); </script> Hope this helps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.