4 Replies Latest reply on Jul 25, 2012 7:55 AM by MikeMcErlean

    Calc Issue

    MikeMcErlean

      This seems like such a simple question, but it is driving me crazy.

       

      I have a script that takes a chunk of text and I want to separate the first line based on the space I have to display it. The rest of the text will display elsewhere, and I don't want missing or duplicated pieces. I set the text into a variable, $theText, and the field lenght into another variable, $fieldLength,

       

      This is complicated because of variable width fonts and existing carriage returns, so I calculate the break point based on the number of whole words that will fit in the space. The problem is the break point caculation.

       

      The failing bit is in the calculation to set the break point. It seemed to work, but then I added the conditions for the carriage return issue, and it hasn't worked since. Removing the newer conditions didn't help.

       

      I've included a screenshot of the calc in my dataviewer to show exactly the issue.

       

      Can anyone explain why this is happening?

       

      Thanks,

       

      Mike

      FileMaker Advanced 11.04, Mac OSX 10.6.8

        • 1. Re: Calc Issue
          Mike_Mitchell

          Hello, Michael.

           

          I'm not sure exactly what you're asking. Your calc contains two Boolean evaluations:

           

               $theTextLength < ~fieldLength

               $theTextLength <= ~fieldLength

           

          The first one is in your Let statement, and the second appears at the tail end of your calc. Those expressions will evaluate to either 1 (if true) or 0 (if not). The second one is returning 1, which means it's true. I don't know what the first one is returning; it's attached to $theTextBreak, which doesn't appear in the result, so it's hard to tell.

           

          What are you looking for it to return? Maybe you might include $theTextBreak in the result to improve clarity? Including a bit more detail would help us figure out where the issue is coming from.

           

          Mike

          • 2. Re: Calc Issue
            MikeRauch

            Mike,

             

            The only way 193 < 43 is if they are text, not numbers.  Use GetAsNumber ( ) at some point to ensure the variables are cast as the correct data type.

             

            Mike Rauch

            • 3. Re: Calc Issue
              MikeMcErlean

              Thanks for this. I swear I tried it last night, and it didn't work. I've got to learn to stop when I'm tired.

              • 4. Re: Calc Issue
                MikeMcErlean

                I sent a screen shot from one of my multiple tries to figure out why this was failing. They both should read 'less than or equal to'.

                 

                And I should have shown the result in screen shot. I'll know better for next time.