Need help with the translate function for mixed case - InfoPath Dev
in

InfoPath Dev

Need help with the translate function for mixed case

Last post 05-16-2012 10:43 AM by ladyath. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 05-16-2012 06:48 AM

    Need help with the translate function for mixed case

    Hi

    I am creating a form that needs to check a username against a Sharepoint group to determine if certain controls would be displayed on an Infopath form.  Using Sharepoint & Infopath 2010.  The problem is that the case of the AD username does not match the case of the Sharepoint group so I figure I need to use translate to fix that.  But I have no idea how to turn domain\USERNAME into DOMAIN\username since all examples seems to force either entire upper or lowercase.  The field that displays the username is set as:

    Value[Name = "AccountName"]

    and I am using the tutorials from http://info.akgroup.com/blog-0/bid/69277/InfoPath-Restrict-visibility-to-users-in-a-SharePoint-Group and http://www.projectpoint.at/?p=97 (tried both) to do what I need to.  But the username always returns as not being a member of the group and I suspect it is because of the mismatch in case.

    Help would be much appreciated.

  • 05-16-2012 09:50 AM In reply to

    Re: Need help with the translate function for mixed case

    You could do a substring to grab everything up to the slash and then uppercase that string.  Likewise for everything after the slash but instead doing lowercase.

    Anson Hidajat
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™

  • 05-16-2012 10:13 AM In reply to

    Re: Need help with the translate function for mixed case

    Rather than translate(), a simpler and more reliable way to perform an case insensitive string comparison is to use msxsl:string-compare():

    msxsl:string-compare(firstValue, secondValue, '', 'i')

    This will return 0 if the values are the same (regardless of case) and -1 or 1 if they are different, so to check if they were the same, you would do this:

    msxsl:string-compare(firstValue, secondValue, '', 'i') = 0

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 05-16-2012 10:43 AM In reply to

    Re: Need help with the translate function for mixed case

    Anson:  Being a newb, I have no idea how to go about using a substring...and...er...the rest you mentioned.

    Jimmy:  but would the string-compare work only on values that are like for like or would it be able to compare if a the logged in user is in the specific sharepoint group I specified in my UserGroup.asmx lookup?

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.