3 Replies Latest reply on Dec 15, 2011 9:58 AM by philmodjunk

    text calculation of relational fields

    applelakshan1

      Title

      text calculation of relational fields

      Post

      Hello guys

      I need  help from you guys.

      01. I  have 2 tables  (letter  and textblcks) layout name also same

      02. both of those have relationship using P_flid ----> f_tbid  allowed to create records on textblocks table

      03. i have portals on final_letter layout

      03. what i need to acomplish

      i will copy and paste  text blocks in to textblocks field and what i wanto to get combination of all text blocks of relatied records.

      snapshot attached

      Thanks

       

      Screen_shot_2011-12-15_at_2.09.06_PM.png

        • 1. Re: text calculation of relational fields
          revmk

          Hello,

          There are a number of ways to do this.  Here is an easy way to achive this:

           

          Create a button on your primary layout with the following:

          Go to Portal Row [select; first]

          Loop

          Set field [field_to_add_to; field_text_is_in & " " & field_to_add_to]

          Go to Portal Row [Select; Next; Exit after last]

          End Loop

          Commit Records/Requests [no dialog]

           

          This should get you going :)

          • 2. Re: text calculation of relational fields
            philmodjunk

            This can be done with a one line script, assuming layout is based on Letter and portal on textblcks.

            Set Field [Letter::TextField ; List ( TextBlcks::TextBlockField)]

            This will merge the contents of all text the the TextBlockField for all records shown in the portal (assuming it is unfiltered), each block will be separated by a return. Any related records with an empty TextBlockField will be omitted.

            • 3. Re: text calculation of relational fields
              philmodjunk

              Hmmm, and on further thought, a script might not be needed at all.

              A calculation field with:

              List ( TextBlcks::TextBlockField)

              would work without any script.

              And you can even avoid the user of a calculation field (maybe) if you set up a list layout based on the portal's table with large text fields set to slide up and resize the enclosing part. This layout could be used to print/save as PDF and the result would look the same as your text field with the combined text blocks.