1 Reply Latest reply on Mar 3, 2010 1:40 PM by comment_1

    Char Function

    drwho

      Title

      Char Function

      Post

      Hi all,

        I am trying to convert a character from one field to a different character in another field.

       

      Example:

         I have two fields,  Code and Answer.

       

      Answer is a calculation type.  Here is the calculation I am trying to use.

         If(Code = "a" ; "r" ; 0)

      So now if I put an   a    in the Code field, Answer should have an   r    in it.  That does work.

      But if I put an   A   in the Code field, Answer still puts an   r   in the field.

       

      So I tried this:  If(Code = Char(97) ; "r" ; 0)   same result. 

       

      My question is, why won't filemaker distinguish between the upper and lower case    a?   By using the Char function, that should be as exact as it gets.  Am I missing something?

        • 1. Re: Char Function
          comment_1

           


          drwho wrote:

          Am I missing something?


          Yes.

           

          "A" = Char (97)

           

          returns true, because Char (97) = "a" and

           

          "A" = "a"

           

          also returns true. Use the Exact() function to make the comparison case-sensitive.

           

           

          ---

          BTW, it seems you'd be better off using Substitute() instead of If() - but I am not really sure what's your purpose here.