function formatNumber(number){ var lastNumber = number.toString().charAt(number.toString().length-1); switch(lastNumber){ case "1": result = "<sup>st</sup>" break; case "2": result = "<sup>nd</sup>" break; ...... } return number.toString()+result;}
$S{formatNumber(12)}
HiYou can write something like this in the init scriptCode: [Select]function formatNumber(number){ var lastNumber = number.toString().charAt(number.toString().length-1); switch(lastNumber){ case "1": result = "<sup>st</sup>" break; case "2": result = "<sup>nd</sup>" break; ...... } return number.toString()+result;}
Can I also use the MOD operator within the script, than it would be easier to write a script for an unknown amount of lines
Paul, the question by Fynjy about the init script location in LMDesigner...Fynjy: смотри файл, там стрелкой указано, где инит скрипт располагать
Paul, QuoteCan I also use the MOD operator within the script, than it would be easier to write a script for an unknown amount of linesLimereport uses javascript. In javascrip Modulus (%) operator returns only the remainder.
function formatNumber(number){ var modNumber = number % 10; switch(modNumber) { case 1 : { tensDigit = number.toString().charAt(number.toString().length-2); switch(tensDigit) { case "1": result = "<sup>th</sup>" break; default: result = "<sup>st</sup>" break; } } break; case 2 : result = "<sup>nd</sup>" break; case 3 : result = "<sup>rd</sup>" break; default: result = "<sup>th</sup>" break; } return number.toString()+result;}