locked
SharePoint 2016 List - Calculated Column RRS feed

  • Question

  • SharePoint 2016 –In the ‘Calc’ column if the ‘Any Notes?’ column is Yes,  then display a checked box;  if No, display an unchecked box.   

      

    However, the Calc column (a calculated column)  shows formula instead of value (a checked box/in_checked box image). 

    I have researched this and tried many things for days, but to no avail.  What am I doing wrong?

    Below is my Formula for the Calculated column

    =IF([Any Notes?]=TRUE,"<img src='http://intranet/Teams/Information_Technology/Team/PublishingImages/cbChecked_locked.GIF' border='0'/>","<img src='http://intranet/Teams/Information_Technology/Team/PublishingImages/cbUnChecked.GIF' border='0'/>")

    Thank you!

    Monday, February 5, 2018 5:56 PM

Answers

  • The "trick" we have used for years to inject HTML into a calculated column was blocked in the updates released last June. The workaround now uses a SharePoint Designer workflow.

    1. Edit the Calculated Column with the HTML and change it's "The data type returned from this formula is" setting back to "Single Line of Text". (Just change the result type... leave the column as a Calculated Column.)
    2. Create a new Multiple Lines of Text column and set it to "Enhanced rich text (Rich text with pictures, tables, and hyperlinks)".
    3. Create a workflow that simply copies the Calculated Column to the new Multiple Lines of Text column. Set the workflow to run on Created and Changed.
    4. Edit your views to hide the Calculated Column and add the Multiple Lines of Text column.

     

    Details are here: http://techtrainingnotes.blogspot.com/2018/01/adding-html-to-sharepoint-columns-color.html

     


    Mike Smith TechTrainingNotes.blogspot.com
    Books: SharePoint 2007 2010 Customization for the Site Owner, SharePoint 2010 Security for the Site Owner

    Monday, February 5, 2018 6:03 PM
  • Mike,

    You're brilliant.  Thank you.  I created the Workflow and all is working great.  Thanks a million!

    DRob

    • Marked as answer by dRob59 Monday, March 12, 2018 4:17 PM
    Tuesday, February 6, 2018 1:00 AM

All replies

  • The "trick" we have used for years to inject HTML into a calculated column was blocked in the updates released last June. The workaround now uses a SharePoint Designer workflow.

    1. Edit the Calculated Column with the HTML and change it's "The data type returned from this formula is" setting back to "Single Line of Text". (Just change the result type... leave the column as a Calculated Column.)
    2. Create a new Multiple Lines of Text column and set it to "Enhanced rich text (Rich text with pictures, tables, and hyperlinks)".
    3. Create a workflow that simply copies the Calculated Column to the new Multiple Lines of Text column. Set the workflow to run on Created and Changed.
    4. Edit your views to hide the Calculated Column and add the Multiple Lines of Text column.

     

    Details are here: http://techtrainingnotes.blogspot.com/2018/01/adding-html-to-sharepoint-columns-color.html

     


    Mike Smith TechTrainingNotes.blogspot.com
    Books: SharePoint 2007 2010 Customization for the Site Owner, SharePoint 2010 Security for the Site Owner

    Monday, February 5, 2018 6:03 PM
  • If you really want to, it can be unblocked in SharePoint on-prem, though.

    https://support.microsoft.com/en-us/help/4032106/handling-html-markup-in-sharepoint-calculated-fields

    $wa = Get-SPWebApplication http://webAppUrl
    $wa.CustomMarkupInCalculatedFieldDisabled = $false
    $wa.Update()

    But Mike goes in the correct, forward looking direction, so his answer is probably more appropriate.

    Trevor Seward

    Office Servers and Services MVP



    Author, Deploying SharePoint 2016

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Monday, February 5, 2018 7:00 PM
  • Mike,

    You're brilliant.  Thank you.  I created the Workflow and all is working great.  Thanks a million!

    DRob

    • Marked as answer by dRob59 Monday, March 12, 2018 4:17 PM
    Tuesday, February 6, 2018 1:00 AM
  • Hi DRob,

    If a reply helps you, please remember to mark it as an answer. It will benefit with others in the community who meet this similar issue in the future.

    Thanks for your understanding and support!

    Best Regards,

    Wendy


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Tuesday, February 6, 2018 2:49 AM