3 Replies Latest reply on Jan 24, 2013 2:44 PM by philmodjunk

    Append text to a field



      Append text to a field


           Is there a way to append text to a field using "set field".

           I have a Activity log field that keeps track of changes on a order.

           I have used Set Selection and and then insert text but you haved to have the "Activity Log" field on the layout.

           Looking for a way to update/append the field with out having to a layout....Any suggestions.


        • 1. Re: Append text to a field

               Are you sure it's the best approach to append mulitiple entries to text in a single field? often it works better to link in a related table where each new entry is a separate related record.

               Set filed can append data to a field if you include the target field as part of the calculated result.

               Set Field [YourTable::ActivityLog ; List ( YourTable::ActivityLog ; //New text in quotes or a field or a text calculation can go here]

               Will append the text, putting the new text at the end of the field starting on a new line.

               Set Field [ YourTable::ActivityLog ; List ( ''New text here" ; YourTable::ActivityLog ) ]

               Will but the most recent text at the beginning of the text in the field


               Set Field [YourTable::ActivityLog ; YourTable::ActivityLog & " New Text" ]

               Appends the new text without starting the appended text on a new line.

          • 2. Re: Append text to a field

                 Phil...this is the way to go!  Thanks....Because now I can slide that setfield line anywhere have notation of record of changes with no problem.

                 I had it set up as you mentioned by creating a new record....Just by using this 1 line it accompishes that...very nicely.  One more question.

                 How can I get rid of some letters from a field.  For example:

            "PrePressArtStatus" I only want the word "ArtStatus"


            • 3. Re: Append text to a field

                   I don't think it's the best way to go. Separate records in a related table make more sense to me and a script with that is little more complex than the append script, but you end up with much better options for how you work with that information when it isn't all merged into a single field.

                   Take a look at the many text functions. There is more than combination of these functions that can do this.

                   Substitute ( "PrePressArtStatus" ;"PrePress" ; "" )

                   is one option, but beware that it is casesensitive. Change the capitalization and it no longer works.

                   Right ( "PrePressArtStatus" ; 9 )

                   works as it returns the 9 characters on the end of the string.

                   And there are ways to combine position, with right, middle or left to manipulate your text to get the same result (without being case sensitive) as well...