Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Procedure for establishing db of text files.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Procedure for establishing db of text files.

    I have a few thousand PLR text files I bought. I would like to load them all up into an existing db or maybe a new db so that I could search for them and have A5 show me in some form the files that would be relevant to my search.

    Some of the files, as you can see from the attachments, do contain a line of keywords. Others are just small articles.

    A few thousand of these articles loaded manually is going to take a very long time and with no one to pay manually to do this it means that I have to do it.

    Is there any way to streamline this approach with A5 along the lines of, "Load all the .txt files in this directory on my harddrive" and have it do so? I played with a similar situation years ago but I think I've forgotten the few things I learned then. I'm not exactly an A5 developer.

    I envision searching for my keyword phrase in Alpha, being shown a focused list of articles meeting my criteria and then my manually opening and copying the contents of 5 or 6 files.

    Could you give me suggestions on the best approach to handling this? Some creative thinking?

    Thanks for all guidance, any and all ideas.
    Attached Files

  • #2
    Re: Procedure for establishing db of text files.

    It shouldn't be too hard to develop a script for you that

    got a list of the text files in a directory
    processed each file in the list
    start a new record in a table
    ------capture the title and put it in a text field
    ------capture the word count and put it in a numeric field
    ------capture the summary and put it in a text field
    ------capture the keywords and put it in a text field
    ------capture the article body and put it in a memo field
    go back an process the next text file


    But your first sample doesn't have the same structure as the second where those parts are broken out. How would one process the 1 What is Accounting... file? To write the script described there have to be rules to interpret the contents of the files.
    There can be only one.

    Comment


    • #3
      Re: Procedure for establishing db of text files.

      The relevant functions to parse the structured file are....

      Code:
      varf = FILE.TO_STRING("C:\Temp\Acid_Reflux_Diet_Tips.txt")
      ? "Title:" $ varf
      = .T.
      
      ? extract_string(varf,"Title:","Word Count:")
      =  
      Acid Reflux Diet Tips
      
      ? extract_string(varf,"Word Count:","Summary:")
      = 
      266
      
      ? extract_string(varf,"Summary:","Keywords:")
      = 
      There are some foods that seem to encourage heartburn in many people.
      
      ? extract_string(varf,"Keywords:","Article Body:")
      = 
      heartburn, acid, reflux, foods
      
      ? words(varf,word_number_get(varf,"Body:",crlf())+1,30000,.F.,crlf())
      = No matter what type of acid reflux you suffer from, and no matter the underlying factors to your own particular struggle with heartburn, a change in diet can have remarkable effects upon your management of acid reflux.
      
      There are some foods that seem to encourage heartburn in many people. Among these are general categories such as spicy, high fat and dairy foods. Chocolate, tomatoes and herbal supplements are also known to bring about heartburn like symptoms, particularly if ingested shortly before bedtime.
      
      If you recognize particular foods that seem to effect heartburn, you may find that eating them in the morning instead of closer to bedtime will alleviate your symptoms of heartburn. When eaten during time of wakefulness and activity, the body is better able to contain stomach acids used to digest the food we have eaten.
      
      Many people suffer from heartburn primarily at night time and have found relief by raising the level of the head of their bed. Though simply adding layers of pillows doesn’t have the same effect, raising the entire head end of a bed by at least twelve inches has been shown to lessen heartburn symptoms.
      
      If you still are suffering from acid reflux and diet modification doesn’t seem to help, you should consider seeing a doctor in order to rule out the possibility of structural abnormality or other factors contributing to your acid reflux symptoms.
      
      Even if you end up trying a prescription medicine prescribed by your doctor, it is a very good idea to try and eliminate foods that make heartburn worse, and increase fresh, raw foods.
      There can be only one.

      Comment


      • #4
        Re: Procedure for establishing db of text files.

        If nothing else then the script would have to screen for which of two formats it has encountered and then branch accordingly?

        Sorry, I think your second post came through as I was commenting on the first post.

        Comment


        • #5
          Re: Procedure for establishing db of text files.

          the script would have to screen for which of two formats it has encountered and then branch accordingly
          Simple enough. Give me the table name and field names you want to use and the directory in which the files reside.

          Code:
          varf = file.to_string("C:\Temp\1 What Is Accounting Anyway.txt")
          ? word(varf,1,crlf())
          = "What Is Accounting Anyway?"
          
          ? alltrim(words(varf,2,30000,.F.,crlf()))
          = Anyone who's worked in an office at some point or another has had to go to accounting. They're the people who pay and send out the bills that keep the business running. They do a lot more than that, though. Sometimes referred to as "bean counters" they also keep their eye on profits, costs and losses. Unless you're running your own business and acting as your own accountant, you'd have no way of knowing just how profitable - or not - your business is without some form of accounting.
          
          	No matter what business you're in, even if all you do is balance a checkbook, that's still accounting. It's part of even a kid's life. Saving an allowance, spending it all at once - these are accounting principles. 
          
          	What are some other businesses where accounting is critical? Well, farmers need to follow careful accounting procedures. Many of them run their farms year to year by taking loans to plant the crops. If it's a good year, a profitable one, then they can pay off their loan; if not, they might have to carry the
          There can be only one.

          Comment


          • #6
            Re: Procedure for establishing db of text files.

            For a table "txts" with fields "field1","field2","field3","field4", and "field5" and the text files in c:\temp

            Code:
            txt_list = filefind.get("c:\temp\*.txt",FILE_FIND_NORMAL,"PN")
            tbl = table.open("txts",FILE_RW_EXCLUSIVE)
            for each foo in txt_list
            	contents = file.to_string(foo)
            	struct_l = "Title:" $ contents
            	if struct_l ' contents are structured
            	tbl.enter_begin()
            	tbl.field1 = strtran(extract_string(contents,"Title:","Word Count:"),crlf(),"")'title field
            	tbl.field2 = val(extract_string(contents,"Word Count:","Summary:"))'word count field
            	tbl.field3 = strtran(extract_string(contents,"Summary:","Keywords:"),crlf(),"")'summary field
            	tbl.field4 = strtran(extract_string(contents,"Keywords:","Article Body:"),crlf(),"")'keywords field
            	tbl.field5 = words(contents,word_number_get(contents,"Body:",crlf())+1,30000,.F.,crlf())'article body memo field
            	tbl.enter_end(.T.)
            	else
            	tbl.enter_begin()
            	tbl.field1 = word(contents,1,crlf())'title field
            	tbl.field5 = alltrim(words(contents,2,30000,.F.,crlf()))'article body memo field
            	tbl.enter_end(.T.)
            	end if
            next
            tbl.close()
            If you might have more than 30,000 lines in the Article Body, adjust the alltrim(words(contents,2,30000,.F.,crlf()))
            There can be only one.

            Comment

            Working...
            X