3 Replies Latest reply on Jan 21, 2015 1:27 PM by philmodjunk

    Nagging Problem in Calculated Field Produces extra space in result

    bokenrosie

      Title

      Nagging Problem in Calculated Field Produces extra space in result

      Post

      I have a calculated expression that returns some text that is then pasted into another application.  It works well but I have one niggle that I cannot figure out.  In my test for the value of "PreliminaryAmount" I end up with extra carriage returns in the result.  I'll post the code and then the results generated.  Thanks.

      CODE BEGIN:

      "SALE TIME: "&SaleTimeSpelledOut&¶ & ¶ & 

      "Refer to Notice of Sale for further bidding instructions" & ¶ & ¶ & 
      If(PreliminaryAmount="yes";
      "*Preliminary, subject to change" ;
      If(PreliminaryAmount="no";
      "";
      0))

      CODE END:

      Result if "Preliminary Amount = yes:

      [Begin]SALE TIME: Until 11:00 AM EST

      Refer to Notice of Sale for further bidding instructions

      *Preliminary, subject to change[End]

      Result if "Preliminary Amount = no:

      [Begin]SALE TIME: Until 11:00 AM EST

      Refer to Notice of Sale for further bidding instructions

      [End]

      In the result above this one I need [End] to appear after the word instructions.

      Thanks for any and all suggestions.

        • 1. Re: Nagging Problem in Calculated Field Produces extra space in result
          philmodjunk
          Post:

          I have a calculated expression that returns some text that is then pasted into another application.  It works well but I have one niggle that I cannot figure out.  In my test for the value of "PreliminaryAmount" I end up with extra carriage returns in the result.  I'll post the code and then the results generated.  Thanks.

          CODE BEGIN:

          "SALE TIME: "&SaleTimeSpelledOut&¶ & ¶ & 

          "Refer to Notice of Sale for further bidding instructions" &
          Case (PreliminaryAmount="yes"; ¶ & ¶ & "*Preliminary, subject to change" ;
          PreliminaryAmount="no"; "";
          0)

          If the only possible values for PreliminaryAmount are "yes" and "no", you can further simplify this to be:

          "SALE TIME: "&SaleTimeSpelledOut&¶ & ¶ & 

          "Refer to Notice of Sale for further bidding instructions" &
          IF (PreliminaryAmount="yes"; ¶ & ¶ & "*Preliminary, subject to change" )

          • 2. Re: Nagging Problem in Calculated Field Produces extra space in result
            bokenrosie

            Of course your version works.  

            From a learning perspective - It would be great to know why my version left in that extra line feed.

            • 3. Re: Nagging Problem in Calculated Field Produces extra space in result
              philmodjunk

              My code:

              "SALE TIME: "&SaleTimeSpelledOut&¶ & ¶ &
              "Refer to Notice of Sale for further bidding instructions" &
              Case (PreliminaryAmount="yes"; ¶ & ¶ & "*Preliminary, subject to change" ;
              PreliminaryAmount="no"; "";
              0)

              Yours:

              "SALE TIME: "&SaleTimeSpelledOut&¶ & ¶ &
              "Refer to Notice of Sale for further bidding instructions" & ¶ & ¶ & 
              If(PreliminaryAmount="yes";
              "*Preliminary, subject to change" ;
              If(PreliminaryAmount="no";
              "";
              0))

              Notice the text in red. In your expression, these two returns are placed after the word Instructions no matter the value of PreliminaryAmount. In mine, they are only produced if PreliminaryAmount is "yes".

              1 of 1 people found this helpful