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

Monthly records appending to existing data tables

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

    Monthly records appending to existing data tables

    every month the Health Dept sent us an ASCII file with all new infectious admissions and we append the ASC file records to our database. I am just getting my feet wet in Alpha - 2 weeks now- can someone please tell me how to write this code in XBasic?

    ** Our database tables are in Access
    ** Demographics is an access table
    ** EPIDemoImport in an ASCII file with the data to update to demographics

    open(Demographics)
    dem_records_Before = records(Demographics)
    record_count = 0
    record_added = 0
    Open(EpiDEMOImport)
    set(EpiDEMOImport)
    loop until eof(EpiDEMOImport)
    clear(dem:record)
    next(EpiDEMOImport)
    Record_Count = Record_Count + 1

    Dem:EIN = epi1:EIN
    Dem:PRIVPRAC = epi1:pmd
    Dem:HMO_HP = epi1:hmo
    Dem:HLTHSTRT = epi1:hs
    dem:CHC = epi1:chc

    add(Demographics)
    if errorcode() = 0 then record_added = record_added +1.
    end
    END

    Basically as a newie to Xbasic I will like to get the XBasic equivalent of this code.

    Thanks you so very much...

    #2
    Re: Monthly records appending to existing data tables

    That's pretty tight code. Probably easier if you attach a small sample of *fake* data as it would appear in your ascii file, and the schema for your table. You can run an import routine, or hand code it if the data needs to be modified as it is imported.
    Steve Wood
    See my profile on IADN

    Comment


      #3
      Re: Monthly records appending to existing data tables

      Originally posted by Steve Wood View Post
      That's pretty tight code. Probably easier if you attach a small sample of *fake* data as it would appear in your ascii file, and the schema for your table. You can run an import routine, or hand code it if the data needs to be modified as it is imported.
      I have very limited experience in working with importing text files into tables. Usually I just pull the data into Excel and save as a dbf. But I have a DOS program that the only way to get any data out of it, is by generating a report and saving it as a text file. This of course leaves all the headers and printer control codes (formfeeds) in the file.

      So Steve, if you see this - where do I start with 'modifying the data' first using xbasic code? The header block of text is consistently the same number of lines, but of course each report will have different dates, pagenumbers etc. After removing that, the data I want should be formatted correctly for importing.
      Last edited by MoGrace; 07-04-2014, 08:51 PM.
      Robin

      Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

      Comment


        #4
        Re: Monthly records appending to existing data tables

        Hi Raul,

        There is no need to write any Xbasic for this as with a little thinking this can all be done with action scripting.

        First build a Temp table that will hold the imported data, looks like just five fields.

        Now build you Operations.

        First one, Zap Temp table.
        Second, Import EPIDemoImport data into Temp table.
        Third, Append from Temp table to Demographics table. Demographics table could have Auto Increment record no field.

        Why the Temp table you may ask, well it allows you to make sure your data is good and clean and also allows you to prevent duplicate import.


        Now build you action scripts by putting all the operations in one at a time. Test run, when you are happy with the results, set each one to run Silent.

        You will be surprised how quickly this runs. Once you have built this you will have the confidence to build even more complex routines.
        Regards
        Keith Hubert
        Alpha Guild Member
        London.
        KHDB Management Systems
        Skype = keith.hubert


        For your day-to-day Needs, you Need an Alpha Database!

        Comment


          #5
          Re: Monthly records appending to existing data tables

          Keith, You're late to the party. Raul's post is 3 years old.
          Peter
          AlphaBase Solutions, LLC

          [email protected]
          https://www.alphabasesolutions.com


          Comment


            #6
            Re: Monthly records appending to existing data tables

            Originally posted by MoGrace View Post
            - where do I start with 'modifying the data' first using xbasic code? The header block of text is consistently the same number of lines, but of course each report will have different dates, pagenumbers etc. After removing that, the data I want should be formatted correctly for importing.
            Robin,

            Grab the text file by putting it into a variable. Take a look at the scanner* functions. You can extract/delete as needed, then save the pout put back as text or whatever form you need it in.

            BTW: the scanner* functions/methods are the cat's pajamas. Super fast and really powerful. They don't flinch on mega-text size files.
            Peter
            AlphaBase Solutions, LLC

            [email protected]
            https://www.alphabasesolutions.com


            Comment


              #7
              Re: Monthly records appending to existing data tables

              Ooops. Thanks Peter.

              I thought with Robin answering it was a New Post. Should have looked more closely.
              Regards
              Keith Hubert
              Alpha Guild Member
              London.
              KHDB Management Systems
              Skype = keith.hubert


              For your day-to-day Needs, you Need an Alpha Database!

              Comment


                #8
                Re: Monthly records appending to existing data tables

                I will Peter, thanks - and then I am sure I will have more questions!
                Robin

                Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                Comment


                  #9
                  Re: Monthly records appending to existing data tables

                  Hi Keith,
                  I was able to import the initial report directly into a temp table as long as all the fields are specified as character. It does take a few other operations after that to get the temp table ready to append - which I expect could be automated inside a script. But Peter's idea of scanning functions sounds like an opportunity to learn something useful as well.

                  We'll see...
                  Robin

                  Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                  Comment


                    #10
                    Re: Monthly records appending to existing data tables

                    Robin,
                    Look into a program called "Monarch". We use it extensively to "scrape" data fields off of reports. Basically, you tell Monarch where to look on the report for the data you want, and it will grab the specific data requested and can even create a .dbf file for you.

                    Tom

                    Comment


                      #11
                      Re: Monthly records appending to existing data tables

                      Hi Tom,
                      Monarch is priced at $1370... Thanks, but I think I will keep looking! ;)
                      Robin

                      Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                      Comment


                        #12
                        Re: Monthly records appending to existing data tables

                        Sorry, Robin, I didn't realize it was so expensive. Our finance department got a copy years ago, and we're still using it.

                        I seriously doubt we paid anything near that way back then.

                        Tom

                        Comment

                        Working...
                        X