5 Replies Latest reply on Jun 8, 2017 11:04 AM by lxr_david

    Retain text color when running script

    lxr_david

      FieldA is formatted with blue text. fieldB is formatted in grey text.

       

      Is it possible to modify the following script to retain the text color format of fieldA when entered into fieldB by the script. I have noticed in testing that when I format fieldA to have blue text and run the script, the script enters the text in fieldB  and matches fieldB's text color format (grey). When I enter text in fieldA and manually change the color of the text in fieldA (red, blue green etc.) the script retains the manually formatted text color when it enters it in fieldB.

       

      Let (

        metaData = List ( Get ( CurrentDate ) ; Get ( CurrentTime ) ; Get ( AccountName ) ) ;

        List (

          Substitute ( metaData ; ¶ ; " - " ) ;

          Table::fieldA ;

      "---------------------------------------------------------------" ;

          Table::fieldB

         )

      )

        • 1. Re: Retain text color when running script
          Philip_Jaffe

          What behavior are you wanting?  Field B to always be grey regardless of the color in field A?

          • 2. Re: Retain text color when running script
            lxr_david

            This is what I am looking for-

            !Script Text Format.jpg

            • 3. Re: Retain text color when running script
              philmodjunk

              As you have discovered, there are multiple ways in FileMaker to display text with a format (including color).

               

              You can format the actual text data by pasting formatted text into a field or by selecting the text in a field while in Browse mode and using the formatting bar to format. Since the data itself is formatted, copying this data to another field also copies over the formatting.

               

              You can, while in layout mode, select a field and use the same formatting tool bar or the Inspector's appearance tab to select a format for the field object on that one layout. Since this formatting is specified for the field object, not the data in the field, copying the data to another field does not copy over this formatting. It's not there to copy.

               

              You can also use conditional formatting to control what text formatting is used to display the text. Like a format selected for the field object, this is also formatting specified for the field on a particular layout and cannot be copied with the data when copying it to another field.

               

              If the text is always to be the same color, You can include the TextColor and RGB function calls as part of the "calculated result" parameter of your set field step to specify a text color. You can look up these functions in Help to see how to use them for this.

               

              And this looks familiar so I am probably repeating myself with this comment:

               

              It would be better NOT to combine these entries in a single field. It would be better to set up a portal with each entry in its own row with separate fields for the date, time, author and comment. Doing it this way limits what you can do with the notes thus entered.

              • 4. Re: Retain text color when running script
                Philip_Jaffe

                Wrap field A with the TextColor ( ) function like this:

                 

                Let (

                  metaData = List ( Get ( CurrentDate ) ; Get ( CurrentTime ) ; Get ( AccountName ) ) ;

                  List (

                    Substitute ( metaData ; ¶ ; " - " ) ;

                   TextColor ( Table::fieldA ; RGB ( red ; green ; blue ) ) ;

                "---------------------------------------------------------------" ;

                    Table::fieldB

                   )

                )

                 

                Where RGB values are between 0-255 based on your desired color

                1 of 1 people found this helpful