Jump to content

tonias81

Registered Users - Approved
  • Posts

    3
  • Joined

Posts posted by tonias81

  1. so everything seems to work but realized that once the template processes, it return Br in the department. (see screenshot)

     

    I've tried enabling/disabling the Treat returned strings as tagged text function with no luck. I do not see anything in the code that would allow/not allow the break. Thoughts

    screenshot.jpg.2690f3ca0b70fc7a37e1b4757be62add.jpg

  2. Thanks Dan, the top code version worked but not the bottom one. I also included a script to remove all "special characters" as well.

     

    here is the code snippet:

     

    var DeptName = ToTitleCase(Field("department"));

     

    var exceptions = [ "a" , "an" , "the" , "for" , "and" , "at" , "by" , "of" , "on" , "to" , "with" ];

    for (var e in exceptions)

    {

    var exception = exceptions[e];

    DeptName = DeptName.replace(new RegExp("\\b" + exception + "\\b", "gi"), exception);

    }

     

    var specialChars = "!@#$^%*()+=-[]\/{}|:<>?,.";

     

    for (var i = 0; i < specialChars.length; i++) {

    DeptName = DeptName.replace(new RegExp("\\" + specialChars, "gi"), "");

    }

     

    switch (DeptName)

    {

    case "Dining & Catering":

    case "Parent & Family Connections":

    case "Department of Technology Leadership & Innovation":

    break;

     

    default:

    DeptName = DeptName.replace("&", "and").replace("Dining and Catering", "Dining & Catering")

    .replace("Parent and Family Connections", "Parent & Family Connections")

    .replace("Department of Technology Leadership and Innovation", "Department of Technology Leadership & Innovation") ;

    break;

    }

     

    return DeptName

     

     

    Again, thanks so much Dan!

     

    --------------

    Tony Hayden

    Xerox

  3. Hello all, I am looking to have a department title change to TitleCase but not conjunctions (to, for, and, the, but, etc.) but I end up getting user input "office of the president" or "OFFICE OF THE PRESIDENT" to translate to "Office Of The President". If I fix one, I lose the other. I also need to have the "&" translate as "and" with an exception to the following: "Dining & Catering", Parent & Family Connections", and "Department of Technology Leadership & Innovation". I believe this code snippet works for that fix. Any thoughts about the title case conjunctions issue?

     

    var DeptName = ToTitleCase(Field("department"));

    DeptName = DeptName.replace("&","and").replace("Dining and Catering","Dining & Catering")

    .replace("Parent and Family Connections","Parent & Family Connections")

    .replace("Departmen of Technology Leadership and Innovation","Department of Technology Leadership & Innovation");

     

    return DeptName

     

    Thanks,

    Tony Hayden

    Xerox

×
×
  • Create New...