Visualforce IF语句:发短信缠绕在顶点

时间:2014-05-24 16:40:02

标签: salesforce apex-code visualforce apex

我有一个包含以下代码的VF页面:

<p>Hi {!Report_Owner.Name}, You achieved your target
{!IF(report.formulaMetric = 100,
"!",
" and surpassed it by {!report.differenceFM}% ")} 
You are not required to do anything else. Thank you.</p>

不幸的是,此时(当formulaMetric = 101或更高时),它返回以下内容:

Hi Robert, You achieved you target, and surpassed it by #{!report.differenceFM}% 
You are not required to do anything else. Thank you.

正如您所看到的,它不是在一个数字(例如1%)上渲染differneceFM,而是将其渲染为文本。我知道这可能是我想要的傻事,但是我如何确保与{!report.differenceFM}相关联的变量被渲染为被认为是被识别为字符串的一部分?

谢谢!

1 个答案:

答案 0 :(得分:1)

更改为:

{!IF(report.formulaMetric = 100,"!"," and surpassed it by" +report.differenceFM +"% ")}