Saved Searches Conditional HTML Formatting

人盡茶涼 提交于 2019-12-08 12:53:13

问题


I'm trying to highlight/indicate individual fields within a saved search column based on a certain criteria. I don't want to highlight the specific row as that will highlight the entire row and not just the single column.

The rudimentary code I have now is

CASE WHEN {custbody487} = 'On Time' 
THEN {custbody487}
ELSE CASE WHEN {custbody487} = 'On Hold' 
THEN {custbody487}
ELSE CASE WHEN {custbody487} = 'Late' 
THEN {custbody487}
END END END

How do I conditionally highlight only a specific column? I want to highlight On Time as green, On Hold as blue, etc. But I only want to highlight the text in that specific column.


回答1:


You can add HTML formatting to saved searches.

Make sure you're using Formula(text) under results. Here's what the above code looks like highlighted.

 CASE WHEN {custbody487} = 'On Time' 
    THEN '<span style="color:green;font-weight:bold">' || {custbody487} || '</span>' 
    ELSE CASE WHEN {custbody487} = 'Late' 
    THEN '<span style="color:red;font-weight:bold">' || {custbody487} || '</span>' 
    ELSE CASE WHEN {custbody487} = 'On Hold' 
    THEN '<span style="color:blue;font-weight:bold">' || {custbody487} || '</span>' 
END END END

Be advised that searches saved this way will not keep their HTML formatting upon export to PDF or CSV. It will be formatted as plain text.



来源:https://stackoverflow.com/questions/55010836/saved-searches-conditional-html-formatting

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!