Freigeben über


InfoPath: Converting data to Upper Case or Lower Case

Here's the formulas to convert the data of the current textbox to UPPER case or lower case.

Convert To UPPER case
translate(., "abcdefghijklmnopqrstuvwyxz", "ABCDEFGHIJKLMNOPQRSTUVWYXZ")

Convert to lower case
translate(., "ABCDEFGHIJKLMNOPQRSTUVWYXZ", "abcdefghijklmnopqrstuvwyxz")

Convert first letter to UPPER case:
concat(substring(translate(., "abcdefghijklmnopqrstuvwxyz", "ABCDEFGHIJKLMNOPQRSTUVWXYZ"), 1, 1), substring(., 2, string-length(.) - 1))

Comments

  • Anonymous
    January 01, 2003
    Awesome, I used this to translate default value by enclosing the text with quotation marks. Yes, I know why not just enter data in all caps? The source is AD display.

  • Anonymous
    January 01, 2003
    Useful info.

  • Anonymous
    January 01, 2003
    As for converting first name and last name to upper case for the first letter, I've not done it myself using formulas. There's someone who have done it using rules. It's pretty cool and works. www.infopathdev.com/.../20998.aspx Download the capitalize.xsn to check out the rules.

  • Anonymous
    January 01, 2003
    Hola, buenas tardes.

    Tuve un requerimiento por parte de un usuario en el cual desea que todas las letras, incluyendo acentos, diéresis, etc., se almacenen automáticamente en formato mayúsculas, por lo cual, les comparto la función que nos facilitará esta tarea complementando la que nos exponen al inicio del blog, la siguiente función toma en cuenta vocales y letras con acentos del tipo grave, agudo, circunflejo, tilde, anillo, ligadura, diéresis, etc.:

    translate(., "abcdefghijklmnñopqrstuvwxyzáéíóúäëïöüàèìòùâêîôûçãåæøý", "ABCDEFGHIJKLMNÑOPQRSTUVWXYZÁÉÍÓÚÄËÏÖÜÀÈÌÒÙÂÊÎÔÛÇÃÅÆØÝ")

    Gracias y saludos cordiales.
    Carlos.

  • Anonymous
    May 03, 2013
    How do I convert first name's first letter to upper  and last name first letter's initial to upper case when they are being captured in the same field and with a space in between. thanks.

  • Anonymous
    January 04, 2016
    Thanks a lot,.

  • Anonymous
    January 29, 2016
    Does this function work for web form?

  • Anonymous
    February 15, 2016
    How can i capitalize the first letter of each word in infopath?