12 Replies Latest reply on Oct 23, 2012 3:34 PM by robwoof

    Importing from Text file

    dezkev

      Hi All

       

      I would like to import the bible into a filemaker DB I have made. (FM 12.0 advanced on windows 7).

      However i am faced with some problems and I am looking for any ideas to help me with this:

       

      The Bible is in a "flat" text format. Like this...

       

      "CHAPTER 1

       

      Ge. 1:1

      In the beginning God created the heavens and the earth.

       

      Ge. 1:2

      Now the earth was [Or possibly became] formless and empty,

      darkness was over the surface of the deep, and the Spirit of

      God was hovering over the waters. "

       

      etc etc...

       

      My Db is a relational Db with separate TO's for Book, Chapter & verse.

      WHen I try to import I see all the text going into one field only - not suprised here as thet text file has no hierarchy (or structure) and neither is it "tab separated" or "comma separated".

       

      So I thought -

      a) Make a flat file DB and import the text file into one global field and then parse each part using Filemakers text functions and put them into the appropriate fields. Then from this flat file DB import into the actual relational DB - not really looking forward to this one

       

      b) Some how format the text and give it some structure so that it can be immported directly into the relational DB - not sure how to do this and if at all posssible.

       

      thanks in advance

        • 1. Re: Importing from Text file
          comment

          How about:

           

          c) Find a source that has already been parsed and import that. For example:

          http://ebible.org/

           

          Message was edited by: Michael Horak

          • 2. Re: Importing from Text file
            taylorsharpe

            I would create a database with a field for book, a field for chapter #, a field for verse #, and a text field for the text.  I would have each verse as a unique record and each record would have the book, chapter and verse # with the text.  I would just import everything into a blank table that has a single record for each line.  Then I would write a script that loops through looking at each line to see if it is the begining of a book or chapter or the start of a verse of the continuation of a verse to determine what to do with each line.  I hope that makes sense. 

            • 3. Re: Importing from Text file
              beverly

              I'd start with a one field table and import as tab delimited. As there probably no tabs, this will import each "line" as a record.

               

              But I'm sure there are resources that already have this in a format that could be imported. 

               

              -- sent from my iPhone4 --

              Beverly Voth

              --

              • 4. Re: Importing from Text file
                dezkev

                To all who replied...

                 

                thank you for all the tips/ideas I received in quick succession. I will explore each one of them and revert progress once done.

                 

                Thanks once again.

                kevin

                • 5. Re: Importing from Text file
                  dezkev

                  Okay, So I got the bible into a filemaker flat file database (following taylorsharpe idea) - with fields for Book,Chapter & verse. This file has 31,111 records.

                  Now to import from here into my relational DB with separate TO's for Book,Chapter and verse (for verse text and verse number).New Picture (2).bmp

                   

                  I have imported the verses (all 31,111 records) into the verse TO.

                  But am having problems with chapter and book TO's. Basically there should be just 66 records in the Books TO (as there as only 66 books in the bible). Not sure how many chapters are there, but definately less than the verses maybe should have about 5-6000 records in the chapter TO. As it stands, I am getting 31,111 records in all 3 TO's.

                  Any ideas about the import procedure.

                  Thanks in advance.

                  Kevin

                  • 6. Re: Importing from Text file
                    taylorsharpe

                    I would put it all in one table with one record for each verse.  Each record would have the text for the verse, the verse #, the chapter number, and Book Name fields.  That keeps it simple.  I hope that makes sense. 

                    • 7. Re: Importing from Text file
                      robwoof

                      Hi Kevin,

                       

                      What you need in the Books table is one record per book (66 records). In the Chapters table, you need one record per chapter, containing Book Name and Chapter. Probably the best way to do this would be to do a Find in Verses for Verse=1 (after all, every chapter has at least 1 verse!). Import these records into the Chapters table, importing only the Book Name and Chapter Number. I am guessing at this stage that "single-chapter" books (Philemon, 2 and 3 John, Jude) have all of their verses listed as "Chapter 1".

                       

                      Note also in your Relationships graph as shown, you probably need to change the relationship between Chapters and Verses so that it's Chapters::Chapter_PKEY to Verses::Chapter_FID.

                       

                      HTH

                      Rob

                      1 of 1 people found this helpful
                      • 8. Re: Importing from Text file
                        dezkev

                        Hi taylorsharpe

                        That is what I have already. Sorry if I was nto clear.

                        I aready have the data in a flat file Filemaker DB. My wuestion is how to go from flat file to Relational ?

                         

                        TIA

                        kevin

                        • 9. Re: Importing from Text file
                          dezkev

                          Thanks Rob - will change the reltionship between chaptt and verse.

                           

                          However could you expound a bit more on the below statement - not sure I understand. "Find in Verses for Verse=1 (after all, every chapter has at least 1 verse!). Import these records into the Chapters table, importing only the Book Name and Chapter Number."

                           

                          The verses are already in the verses TO. Are you asking to import them into the chapters TO ?

                           

                          Thanks

                          Kevin

                          • 10. Re: Importing from Text file
                            comment

                            taylorsharpe wrote:

                             

                            I would put it all in one table with one record for each verse.  Each record would have the text for the verse, the verse #, the chapter number, and Book Name fields.  That keeps it simple.  I hope that makes sense. 

                             

                            I don't think that's a good idea, because then you have no room for fields that describe a chapter or a book. For example, a book may have alternative names or belong to a group.

                            • 11. Re: Importing from Text file
                              comment

                              dezkev wrote:

                               

                              I aready have the data in a flat file Filemaker DB. My wuestion is how to go from flat file to Relational ?

                               

                              First, define a table (not a table occurrence) of Books. Set the book name field to validate as Unique, Validate always. Then import data from the the flat table. Do the same for chapters, this time validating an auto-entered concatenation of book & chapter.

                               

                              Alternatively, sort the flat table by book and export the records grouped by book. Then import the result into a new table. For chapters, sort by book and by chapter and group by chapter.

                              • 12. Re: Importing from Text file
                                robwoof

                                Hi Kevin,

                                 

                                That's right - just one record for each Chapter in each Book. You can do that, as long as Chapters is a separate Table, not just a separate occurrence of the Verses table. You do the find (Verse=1) in Verses, then go to a layout whose base table is Chapters, and go to File->Import Records->File…. The file you chose to import from is the same file (i.e. itself), and you make sure the "Source" (top left) is Verses. You just import the Book and Chapter fields into the Chapters table.

                                 

                                If you find the concept of importing from one table to another within the same file is making your head explode, you could export the Book and Chapter fields from the Verses table into a text file, Excel spreadsheet (or even a FileMaker file!), and then import from that. But the "internal" import from one table to another saves a step.

                                 

                                The logic for the search is that every Chapter has a number of Verses, and every Book has a number of Chapters, and these numbers vary from Book to Book and Chapter to Chapter. BUT every Chapter has a Verse 1. So you know that if you find all of the Verse 1s, your found set is a record for every Chapter in every Book. That's what you want in your Chapters table.

                                 

                                HTH

                                 

                                Rob