6 Replies Latest reply on May 26, 2017 8:25 AM by philmodjunk

    Multiple formulas in auto-enter calculation

    fnfmk

      Hello,

       

      I need to set a field calculation so that the contents are uppercase and that the original text format (e.g. in case of copy/paste) is removed.

      Is it possible to use both the formulas in the same calculation? (I'm obtaining odd results)

       

      thanks

        • 1. Re: Multiple formulas in auto-enter calculation
          erolst

          You can always "nest" functions; the formula is evaluated starting with the innermost function, and the result

          is being passed to the next function.

           

          Try

           

          Upper ( TextFormatRemove ( self ) )

           

          An alternative to nesting, especially with complex formulas, is using Let(), e.g.

           

          Let (

            asUpper = Upper ( self ) ;

            noFormat = TextFormatRemove ( asUpper )

            ] ;

            noFormat

          )

           

          which in this simple scenario is sort of overkill, but you can see the principle of having simple expressions pass their result to other simple expression s, in order to reduce overall complexity.

          1 of 1 people found this helpful
          • 2. Re: Multiple formulas in auto-enter calculation
            keywords

            Let ( ) is THE function when it comes to this sort of problem, and I endorse erolst's recommendation, except that I would put the expressions the other way round so that you first get rid of imported formatting, then apply your own—

             

            Let (

                 noFormat = TextFormatRemove ( self )

                 asUpper = Upper ( noFormat ) ;

               ] ;

              asUpper

            )

            1 of 1 people found this helpful
            • 3. Re: Multiple formulas in auto-enter calculation
              fnfmk

              thank you all!

               

              before reading your suggestions I solved with a script that does it all OnObjectSave ... I'm sure your way is more straightforward, elegant and probably faster, so i'll definitely check it out!

               

              regards

              • 4. Re: Multiple formulas in auto-enter calculation
                philmodjunk

                Note that there are two "contexts" in which you can make this change to the text:

                 

                via a script trigger performed script. If you do this, the change to the text only occurs if the script trigger is tripped and only on the layout where you set this up.

                 

                Via auto-enter calculation. In this case, every newly added record will have this change made to the data no matter which layout might be used to enter it. Two exceptions: Adding or changing an auto-enter calculation does not modify the value in records created prior to that change. If you import data and do not allow auto-enter options, you can put data in the field without the auto-enter calculation modifying the data.

                1 of 1 people found this helpful
                • 5. Re: Multiple formulas in auto-enter calculation
                  fnfmk

                  Thanks for the clarification philmodjunk

                  In this case data are entered only through this specific layout, so it should work fine... but I'll keep this tip in mind for future features/projects

                  • 6. Re: Multiple formulas in auto-enter calculation
                    philmodjunk

                    Last year, I made a user group presentation on avoiding "Brittle" database design--avoiding features that easily "break" when future changes occur--either by the user or a developer. Keep in mind that for the moment, data entry only happens on the one layout. In the future, that might not be the case.

                    1 of 1 people found this helpful