Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

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

Importing Sequential Text File

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

    Importing Sequential Text File

    I think this is called a sequential file, but I'm not sure. Anyway, I need a way to import a text file in this format using v10.5 in a desktop app:

    John smith
    9999 TANGLEWOOD CT
    RIDGEFIELD, CT 06877-5512
    Phone:000-000-9250


    Dougie Smith
    88888 Stanford Ave
    Dallas, TX 75225-6931
    Phone:777-777-7712


    Linda Davisss
    8989 W Grand Ave
    Connersville, IN 46666
    Phone:766987777

    I obtain the information through copying and pasting and creating a text file, but would like to automate the import. The number of lines often changes - sometimes four, but could be five or six.

    Anyone able to get me started on this?

    Thanks.
    Ed Merritt
    UniversalWorkshop.com

    Listen; there's a hell of a good universe next door: let's go.
    e.e. cummings




    #2
    Re: Importing Sequential Text File

    Is there any defined start and end point. Eg: I note you have a line space between each record. If this is the case then I would loop through the list replacing the CR with something "|" and where the line spac is I would replace with a CR. This would then give you a list that could be imported. The main issue at the end would be lining each record up so all fields match.

    Do you have a 5 and 6 line example - I am presuming te extra lines will be part of the address section but the rest is contant like the name and the phone?
    -----------------------------------------------
    Regards
    Mark Pearson
    [email protected]
    Youtube channel
    Website

    Comment


      #3
      Re: Importing Sequential Text File

      I had a bit of a play with your example. I copied and pasted into notepad and saved. Then I made this script. Copy it and paste into code then run. It should:

      1. Allow you to find the file
      2. Edit it and put into a listview xdialog

      dim prmpt_title as c
      dim prmpt_filter as c
      dim prmpt_default as c
      dim prmpt_flag as c
      dim cont1 as c
      prmpt_title = "Select File"
      prmpt_filter = "(*.txt)"
      prmpt_default = ""
      DIM SHARED myfile AS C

      myfile = ui_get_file( a5_eval_expression(prmpt_title,local_variables()),prmpt_filter,prmpt_default,"X")

      cont1 = file.to_string(myfile)
      cont1 = stritran(cont1,crlf(),"|")
      cont1 = stritran(cont1,"|||",Crlf())

      ui_dlg_box("Quick ListView",<<%dlg%
      {wrap=100}
      [%M;K;%.120,20id^"Col1:30|Col2:30|Col3:30|Col4:30"Cont1!idchange];
      %dlg%,<<%code%

      %code%)
      -----------------------------------------------
      Regards
      Mark Pearson
      [email protected]
      Youtube channel
      Website

      Comment


        #4
        Re: Importing Sequential Text File

        If you want to completely parse this into individual fields and individual records, this example might work for you. The example makes 3 suppositions:

        1. the difference between those with 4, 5, 6 lines are additional address lines
        2. there will always be a comma following the city name
        3. there will always be a the full-colon before the phone number
        Attached Files
        Mike W
        __________________________
        "I rebel in at least small things to express to the world that I have not completely surrendered"

        Comment


          #5
          Re: Importing Sequential Text File

          Mike:
          My original post left out a few things, so I grabbed a screen cap of an example address when it's in a Word document and the non-printing characters are viewable. Each address that I'm able to scrape from the web page is essentially the same, although some addresses have up to six lines. The constants in the addresses are the words "Your Merchant Order ID", "Payment Information" followed by a hard return, "Shipping Address:" followed by a hard return, and the last line "Shipping Phone:" and the final hard return.

          Here's what it looks like: 2012-01-04_1532.png

          Hope this helps a bit.
          Ed Merritt
          UniversalWorkshop.com

          Listen; there's a hell of a good universe next door: let's go.
          e.e. cummings



          Comment


            #6
            Re: Importing Sequential Text File

            So,
            I don't see Shipping Phone. Is that Phone:? That example is 7 lines.

            Starting from the bottom, it is always: phone, city-state-zip, address, name, then lines (0-?)above that are not needed?

            Why not just post an example of a notepad file that has about all the combinations that you might envision and that you would be wanting to extract so I can see what the needs are?
            Last edited by Mike Wilson; 01-04-2012, 07:14 PM.
            Mike W
            __________________________
            "I rebel in at least small things to express to the world that I have not completely surrendered"

            Comment


              #7
              Re: Importing Sequential Text File

              If it is that the last 4 lines are constant and the top 3 are the garbage, the attached is an example that would parse those.
              Attached Files
              Mike W
              __________________________
              "I rebel in at least small things to express to the world that I have not completely surrendered"

              Comment


                #8
                Re: Importing Sequential Text File

                Originally posted by Mike Wilson View Post
                So,
                I don't see Shipping Phone. Is that Phone:? That example is 7 lines.
                Starting from the bottom, it is always: phone, city-state-zip, address, name, then lines (0-?)above that are not needed?
                Why not just post an example of a notepad file that has about all the combinations that you might envision and that you would be wanting to extract so I can see what the needs are?
                You're right, it's "Phone:" only. The lines at the top contain the customer order number and that is essential. The first text is always "Your merchant order ID: #". Payment information is a link that is garbage, then "Shipping Address:" then the actual data, then it always ends with "Phone:".

                Here's a more detail. An Amazon seller's account displays a web page of all orders sold by Amazon for the merchant's items. The customer's name and address is not available for download but it is displayed on the web page detail of a given order. Oddly, they do make available a report that can be downloaded with everything except that address information.

                What I've been doing is to open the web page with the order detail, copy and paste the name and address along with the order number. I then manually massage that data and turn it into a comma-delimited text file which I then import into A5 as order header data. The download report also contains the order number and comprises the order detail data. When joined as a set, I have a complete record of the transaction and the ship-to recipient's address. The blank lines under the "Phone:" data are put there by me for readability, but they can go away if that makes things easier.

                What I'm hoping to accomplish is to develop a script that will essentially do what I do manually - parse the data, and convert it to a comma-delim file that I can import. I'll still have to do the copy 'n paste routine, but that's easy. It's the manual massaging that's a killer.

                Anyway, I've attached a text file the way it looks when I do the copy 'n paste stuff. In this example, there are two international addresses, and that's where the extra lines usually come in. They shouldn't be a deal-breaker because they comprise only a few orders each month and handling them manually is fine. The majority are US addresses and a script would be a slice of heaven as opposed to the drudgery of copy 'n pasting and manipulating text.

                I appreciate you taking time to look at this Mike. I know there are file formats such as the .QIF used by financial programs that are laid out like this, and even XML files are somewhat similar, but they have markers that delineate where a script should start and stop. This one has me stumped, and my limited Xbasic skills are of little help.
                Attached Files
                Ed Merritt
                UniversalWorkshop.com

                Listen; there's a hell of a good universe next door: let's go.
                e.e. cummings



                Comment


                  #9
                  Re: Importing Sequential Text File

                  Parsing text files can be an arduous task.There is a software program
                  called Monarch, which is a "data mining " program that i highly recommend for tasks like you describe. I have clients that import text files from their customers with varying formats.They are not programmers nor are they technically gifted.They successfully use Monarch to create parsing templates geared to particular customers.
                  I use Monarch commands within Alpha to generate text files to be imported by Alpha's predefined import operations.

                  Comment


                    #10
                    Re: Importing Sequential Text File

                    Ed,
                    I know that your trying to be as clear as possible but exactness in what exactly are the consisancy of the text blocks is absolutely necessary to solve your need. It is essential to have clearly defined what are the constants and what are the variables in the text blocks that need evaluating to define the extraction routine.

                    I'll still have to do the copy 'n paste routine, but that's easy. It's the manual massaging that's a killer.
                    The majority are US addresses and a script would be a slice of heaven as opposed to the drudgery of copy 'n pasting and manipulating text.
                    First you say cutting and pasting is easy, then it's drudgery. Is cutting and pasting going to be a task that is maintained in the final solution, or are you seeking a solution that replaces your having to cutting and pasting?

                    You gave me an example with every text block containing the top three lines containing "Your Merchant Order ID: #,Payment Information, Shipping Address:. Again, I ask, is this a constant? Will every text block have those as the top three lines? Will there always be a Phone:xxxx line?

                    You have now added that there are addresses for foreign countries. An added "Oh by the way" that changes the ball game. I'd be more than happy to help you, but like I said in post thread #6 -
                    Why not just post an example of a notepad file that has all the combinations that you might envision and that you would be wanting to extract so I can see what the needs are?
                    Absent exactness and completeness, a routine for extraction cannot be acheived.
                    Mike W
                    __________________________
                    "I rebel in at least small things to express to the world that I have not completely surrendered"

                    Comment

                    Working...
                    X