3 Replies Latest reply on May 1, 2015 6:50 AM by philmodjunk

    Extracting Clauses in Outline in One Big Field to Multiple Portal Records

    EKZ

      Title

      Extracting Clauses in Outline in One Big Field to Multiple Portal Records

      Post

      REC0007

      Clause 02 of 07

       

      Subject is About Extracting Text

       

      Have text outline of sorts with multiple clause that are formatted hopefully like this post is supposed to look. "My Text Field"  size is about 3/4" less - all the way around - from the margins of a standard letter size. To the right of "My Text Field" is a 6 row related portal with a scroll bar -portal size is about the same hight as "My Text Field" and slightly less in width. Want to have the contents from each clause separately extracted to its own portal record. In this case 7 clauses i.e. 7 portal records. Further, each clause is intended to be parsed to 4 separate fields for each portal record. The field names can be as follows: 1) Record Number 2) Clause Number 3) Clause Subject 4) Clause Description. Learning "how to" would be great and how to to do the same in reverse would be a huge bonus!

       

      FM_Extracting_Text.png

        • 1. Re: Extracting Clauses in Outline in One Big Field to Multiple Portal Records
          philmodjunk

          In the above example, it would appear that:

          GetValue ( textField ; 1 ) would return the text: REC0007
          GetValue ( textField ; 2 ) would return "Clause 01 of 07"
          GetValue ( textfield ; 4 ) would return "Subject is about extracting text" ---> I'm assuming that  there are two returns between clause and subject.

          • 2. Re: Extracting Clauses in Outline in One Big Field to Multiple Portal Records
            EKZ

            Thank you kindly for your answer. Followup Question - before I give your instructions a try are you saying that when using the text funtion: GetValue( text field; 1) and the same for 2 , 3 and so on that FM recognizes a TextValue as one word when between paragraphs? or Returns? ( not sure of the corect terminology ). Also  forgot to ask-  What would a script need to include to accomplish the desired routine? I assume it will include the loop steps to get each set of values contained in each  "clause" then "push" them  into the separate portal records (mentioned in the prior post). Each portal record  contains  the 3 or maybe 4 fields that corespond with the just mention values. Again thank you for you help. This is great.

            • 3. Re: Extracting Clauses in Outline in One Big Field to Multiple Portal Records
              philmodjunk

              What you have can be seen as a list of values in a field separated by returns--a frequent occurrence in Filemaker databases as there are number of ways such lists are produced and used.

              GetValue extracts all text from the field between those returns. The second parameter specifies which item in the list is being extracted. It does not perceive the text extracted as a single word.

              You are correct that you would need a looping script.

              If you had these tables and relationships:

              Document----<Paragraphs
              Document::__pkDocID = Paragraphs::_fkDocID

              this script, performed from a layout based on Paragraphs would parse the data into separate records, skipping blanks:

              Set Variable [$Text ; Document::Textfield ]
              Set Variable [$DocID ; value: Document::__pkDocID ]
              Loop
                 Set Variable [$K ; value: $K + 1 ]
                 Exit Loop If [ $K > ValueCount ( $Text ) ]
                 Set Variable [$paragraph ; value: getValue ( $Text ; $K ) ]
                 If [ Not Isempty ( $Paragraph ) ]
                    Go to Layout [ "Paragraph" ( Paragraph ) ]
                    New Record/request
                    Set Field [ Paragraph::_fkDocID ; $DocID ]
                    Set Field [ Paragraph::Paragraph ; $Paragraph ]
                    Go to layout [ original layout ]
                End If
              Loop

              This probably isn't exactly the script you need as I think you want to put different blocks of text into different fields of the same related record, but it should serve as a rough outline of what you need to do. Much will depend on how consistently the text in your original document is formatted. The presence of varying numbers of returns between paragraphs, for example, will complicate things if you need to populate different fields of the same record as I suspect that you need to.

              Caulkins Consulting, Home of Adventures In FileMaking