6 Replies Latest reply on Jul 28, 2016 3:07 PM by DavidJondreau

    Dynamic TextBox Changes

    user26705

      I have been reading about this on the FMC and also on the web at large, but can't seem to get a clear answer on if this is possible.

       

      I would like to change the text in a textbox based on some condition:

       

      For example:

       

      If TimeofDay = Morning

           TextBox "Good morning!"

      Else

           TextBox = "Good day to your sire!"

      End If

       

      another example would be that I want to show a count of records or display a total amount.  I don't want to use a table or calculated field for this if at all possible...but rather just change the textbox contents based on a script...as in:

       

      TextBox = Count(#ofRecords)

       

      or

       

      TextBox = Sum(Revenue)

       

       

      Your guidance is greatly appreciated.

        • 1. Re: Dynamic TextBox Changes
          coherentkris

          if by textbox you mean edit box then you must "bind" it to a field in a table to have it show anything.

          You might investigate merge fields or merge variables to display text on a layout that is NOT bound to a field in a table

          1 of 1 people found this helpful
          • 2. Re: Dynamic TextBox Changes
            user26705

            Thanks - but was referring to text that isn't bound to anything - in essence a label.

            • 3. Re: Dynamic TextBox Changes
              philmodjunk

              This is a typical request made by developers used to alternative methods used in other systems.

               

              There is no such text box possible in FileMaker systems. You must use alternative methods to achieve the same results. An unstored calculation field is one such option.

               

              Other options:

              Put two text objects on your layout and give them different "hide object when" settings so that one and only one is visible at any given time.

               

              Put a merge variable such as <<$$GreetingText>> on your layout and use a script--likely performed by the OnLayoutEnter trigger to assign a value to the variable.

               

              Often, a global field is defined and placed on a layout to do the role filled by an unbound text box in other systems. This global field could also be set to a value by a script. This is pretty much your only option if you want the data in the field to be directly editable by users.

               

              There are other cute tricks that use conditional formatting or Hide Object When expressions and the Let function to assign a value to such a merge variable, but FileMaker Engineers have been advising against such use given the changes that they have "in the pipeline" for future releases of FileMaker.

              1 of 1 people found this helpful
              • 4. Re: Dynamic TextBox Changes
                coherentkris

                hence my comment about merge variables.. look them up

                • 5. Re: Dynamic TextBox Changes
                  user26705

                  Merge Variables did the trick - now I just have to figure out how to Sum and Average the records in a table using the Merge Variables - thanks for your guidance.

                  • 6. Re: Dynamic TextBox Changes
                    DavidJondreau

                    You should also look into button bars. Their labels can be calculations.

                    1 of 1 people found this helpful