6 Replies Latest reply on Aug 10, 2013 6:18 AM by zaza

    Styling text with bullet points

    zaza

      Title

      Styling text with bullet points

      Post

           Hi

           I am trying to setup a field so that when text is added each line automatically starts with a bullet point. I have been able to get some success with the following calculation:

           Substitute ( Substitute ( Substitute (Feature ; "¶" ;  TextFont (TextSize ( "¶l    "; 7); "Wingdings") ); "  "; " "); "  "; " ")

      Result:

      Cat

      Dog

      Mouse

           [# represents bullet symbol]

            

           However, if I go back and edit the text in that field I get double bullets appearing.eg.

      #  #  Cat

      #  #  Dog

      #  #  Mouse

            

           If I try to remove the extra bullet it just gets worse - 3 bullets appear!

            

           Any adivce? How can I edit bulleted text without extra bullets appearing?

        • 1. Re: Styling text with bullet points
          philmodjunk

               Don't see any reason for the outer substitute function calls as it appears that they replace a space with a space...

               Modify your calculation to remove all bullet characters before doing the substitute to replace returns with the "ReturnBullet" text.

               And you can use the [ ] syntax instead of nesting calls to substitute.:

               Substitute (Feature ;  ["l   " ; ""  ] ;   [ TextFont (TextSize ( "¶l    "; 7); "Wingdings") ] )

          • 2. Re: Styling text with bullet points
            zaza

                 Hi

                 Thanks for the suggestion - just tried it but getting error message : 'too few parameters in this function'

                 What am I missing?

            • 3. Re: Styling text with bullet points
              philmodjunk

                   I'm missing a parameter in what I suggested:

                   Substitute ( "Feature" ;  ["l   " ; ""  ] ;   [ ¶ ; TextFont (TextSize ( "¶l    "; 7); "Wingdings") ] )

              • 4. Re: Styling text with bullet points
                zaza

                     I'm afraid your revision still is not working - no bullets are added.

                     Basically I want to paste in or write text in the field so when field is committed/exited I want each paragraph to be preceded by a bullet and tab. but not to add further bullets/tabs when later amendments are made.

                     I used " ¶" so I could use find and replace script but I suspect this is causing the double bullets?

                ¶   to become/reformat as:

                # [tab] xxxxxxx

                # [tab] xxxxxxx

                      

                • 5. Re: Styling text with bullet points
                  philmodjunk

                       I played around with this in my Data Viewer feeding different text to the calculation. To keep the expression simple, I used a # instead of the bullet character. I was always a bit surpriesed that you weren't having an issue with the very first item on your list not getting a bullet. The following fixes that issue as well as inserts # where needed without doubling them if one is already there:

                       Let ( [ t =  Substitute ( YourFieldHere ; "#" & Char ( 9 ) ; "" ) ; // all existing bullet-tab character pairs are removed here
                                  t1 =  Substitute ( ¶ & t ; ¶ ; "¶#" & Char ( 9 ) ) ] ; // a leading return is added so that all items have a return in front and then bullet-tabs added
                                  Right ( t1 ; Length ( t1 ) - 1 ) // leading return is removed from text.
                              )

                       You would subsitute each use of # with the expression you'd need to put the bullet character from wingdings in place.

                  • 6. Re: Styling text with bullet points
                    zaza

                         A great big thank you - fantastic! It works!

                         Months of frustration finally ended!

                         I adapted your calculation as follows:

                         Let ( [ t =  Substitute ( MyField; "l" & Char ( 9 ) ; "" ) ;
                                    t1 =  Substitute ( ¶ & t ; ¶ ;  TextFont (TextSize ( "¶l" & Char ( 9 ); 7); "Wingdings") ) ] ;
                                    Right ( t1 ; Length ( t1 ) - 1 )
                                )

                          

                    smiley