8 Replies Latest reply on Dec 15, 2015 4:10 AM by keywords

    Formatting inside $$variables

    tkemmere

      I'm wondering...

       

      I have this FM solution that generates standard letters, using variables. For example, <<$$Body>> is calculated from all kinds of related fields and choices by the user. I have a script that generates and refreshes the window that depicts the standard letter-to-be-printed. But inside the body text I need certain words to be formatted in SmallCaps. How do I do that?

       

      Thanks for the help.

      Regerds, Thomas.

        • 1. Re: Formatting inside $$variables
          keywords

          The simplest way is to apply the Small Caps style to the text object that contains the merge variable—

           

          Some standard text: <<$$mergeVariable>> <<MERGEFIELD>> more text. <<anotherMergeField>>

           

          You can apply formatting to all or part of the text.

           

          Screen Shot 2015-12-14 at 9.17.27 pm.png

          • 2. Re: Formatting inside $$variables
            tkemmere

            Hi Keywords,

            Thanks.

             

            Yes. I guess that is the (only) way to go. I was hoping for the option to put HTML or CSS sort or tags inside the variable, but that was wishful thinking.

             

            Problem is that the Body is built up from 3 different cases. Like:

             

            Set variable [$$Body; Value:

            Case(SettingsTable::Choice="Letter type One" ; "Body text body text Body text";

            SettingsTable::Choice="Letter type two"      ; "Other body text other Body text";

            SettingsTable::Choice="Letter type Three"    ; "Third body text third Body text";)

             

            So to "interrupt" the case statement becomes quite complicated, especially since there are up to 3 points in each of the texts that need formatting. They're three different letters of about one page and the amount of times that formatting is required is not the same in each of the letters...

             

            I'm afraid the best way to go is to cut it up into 3 different layouts. (?)

            • 3. Re: Formatting inside $$variables
              keywords

              I didn't say that my initial suggestion is the ONLY way, just the quickest and dirtiest. Given what you've added, I suggest you explore the use of Text Formatting functions, especially TextStyleAdd ( ).

              I would also suggest you explore the use of the Lat ( ) function (my personal favourite) for building longer, more complicated calculations.

              • 4. Re: Formatting inside $$variables
                tkemmere

                Great! Good news. Thank you keywords.

                That is why I put the 'only' in between brackets, as I wasn't actually sure. And I left the question open.

                Thank you for getting me going on this. I will study TextStyleAdd() as well as Lat() and related functions.

                Regards, Thomas.

                • 5. Re: Formatting inside $$variables
                  tkemmere

                  Yesss! I succeded. Thanks!

                  Keywords

                  • 6. Re: Formatting inside $$variables
                    keywords

                    Quick correction to my last post (I blame autocorrect): I meant of course Let ( )—but I guess you have worked that out since you have progressed with your project.

                    • 7. Re: Formatting inside $$variables
                      tkemmere

                      I did manage very well with TextStyleAdd() only.

                      I did look into Lat() and noticed it is all about GPS locations.

                      I will look into Let() What I can use it for.

                       

                      Here's the "annonimised" result:

                      • 8. Re: Formatting inside $$variables
                        keywords

                        It's a tiny image, but it looks like you've done well. Re the Let() function, there is one of its uses apparent in your Case statement—reducing database calls. You have:

                        Case(SettingsTable::Choice="Letter type One" ; "Body text body text Body text";

                        SettingsTable::Choice="Letter type two"      ; "Other body text other Body text";

                        SettingsTable::Choice="Letter type Three"    ; "Third body text third Body text";)


                        —which calls the field SettingsTable::Choice up to three times. Calling that field as a variable within the Let function reduces that to one:

                        Let (

                        [

                        letterType = SettingsTable::Choice ] ;

                        Case(

                        letterType ="Letter type One" ; "Body text body text Body text";

                        letterType ="Letter type two"      ; "Other body text other Body text";

                        letterType ="Letter type Three"    ; "Third body text third Body text" )

                        )

                        Anyway, good luck with your learning!