Jump to content

Trouble printing a greater than sign


ctaylorcolortech

Recommended Posts

I have a field that sometimes contains "--", sometimes contains numbers such as "28" and sometimes contains a greater than sign followed by a number such as ">95". If the field shows a number or a number with at greater than sign I need to add a %. Sounds simple except that I cannot get the greater than sign to print. If I just put the field in a text box and display it the > shows but when I put it into a rule I lose the > sign. I have tried the rules wizard and javascript. I have tried every combination of \ " that I can think of and it still does not show. Here is the javascript that I currently have:

if (Field("GMET_7") == String("--"))

{

return "<span>" + String("--") + "</span>";

}

if (Field("GMET_7") == String(">95"))

{

return "<span>" + String(">95%") + "</span>";

}

else

{

return "<span>" + Field("GMET_7") + String("%") + "</span>";

}

return "";

I have also tried:

if (Field("GMET_7") == String("--"))

{

return "<span>" + String("--") + "</span>";

}

else

{

return "<span>" + String(Field("GMET_7")) + String("%") + "</span>";

}

return "";

 

In both cases when the field is >95, what gets displayed is 95%. The > does not show. I am sure it is something simple but I cannot figure it out.

 

Please help!

Link to comment
Share on other sites

In a rule such as this which is returning tagged text (markup), you need to call the TaggedTextFromRaw function (or NormalizeEntities in older versions of FusionPro) on any fields or literal text you're returning, so that the parser knows that certain special markup characters (such as less-than, greater-than, and ampersand) in the text should be interpreted literally instead of as parts of markup tags. Try this:

if (Field("GMET_7") == "--")
   return "--";
//else
return TaggedTextFromRaw(Field("GMET_7") + "%");

Also, in the latest version of FusionPro, 7.0P1d, the drag-and-drop Rule Wizard will correctly place calls to TaggedTextFromRaw around returned text for you, so you can go back and do this in the Rule Wizard in 7.0P1d instead of using JavaScript if you like.

Link to comment
Share on other sites

Actually, since you're not really doing anything significant with tagged markup here, there's an even easier way to solve this: Just uncheck the "Treat returned strings as tagged text" box, and then you can remove the call to TaggedTextFromRaw, like so:

if (Field("GMET_7") == "--")
   return "--";
//else
return Field("GMET_7") + "%";

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...