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

append current record II

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

    append current record II

    Are there any advantages of using one over the other?

    <TBL>.COPY_RECORD_TO()

    vs

    append.run("append_operation_name","recno() = " + table.current().recno() )

    Consider an environment in which the receiving table has 1 million records and the from table has 100k records, networked.

    ba

    #2
    Re: append current record II

    If there is any advantage, it would be in terms of execution time and as they say, the proof is in the pudding. I'd run both and check for speed. And while you are at it, you could also test another one:

    t=table.current()
    t1=table.open("..target_table..")
    t1.enter_begin()
    t1.fiield1=t.field1
    ..etc..
    t.enter_end(.t.)
    t.close
    t1.close()

    Or, another one:

    <TBL>.RECORD_DATA_GET()
    <TBL>.RECORD_DATA_SET()

    Or, another one:
    <TBL>.RECORD_CLONE()

    Personally, and without checking speed, I common-sensically opt for:
    table.open()
    table.enter_begin()
    etc.
    as I assume all other "functions" are simply wrappers and include this routine in their guts.

    P.S.
    Something funny about speed I have yet to put my finger on: you could run a speed test on the same function under the same conditions and come up with different results. So, unless your results show "significant" difference, I wouldn't favor one or the other.

    Comment


      #3
      Re: append current record II

      Hi Bob,

      Originally posted by Bob Arbuthnot View Post
      Are there any advantages of using one over the other?

      <TBL>.COPY_RECORD_TO()

      vs

      append.run("append_operation_name","recno() = " + table.current().recno() )

      Consider an environment in which the receiving table has 1 million records and the from table has 100k records, networked.
      The reason Alpha can be simple and at the same time fast is they have created fast primitives that perform operations that are defined to have a large scope.

      The append operation is one of these. Rather than copying 1 record at a time and repeating via XBasic (relatively slow versus a C type code) as in the copy record_to(), it does an append of many records. Depending upon your append options, the 1st thing it might do is perform a query of the source or destination tables. Make sure your filters will invoke LQO, otherwise you will be doing a slow query.

      However, and this is a big one, the time to append a record when in a shared environment (using a non-client-server format like DBF) that has more than 2 or more current users/opens of the destination table, the append has to save 1 record at a time, updating the data and indexes, and this is relatively slow process.

      The moment you are the only use of the table (not necessarily opened as exclusive), it switches to another mode. In this mode, it appends all the records quickly, then rebuilds the indexes at the end. If you have a lot of records and/or indexes, this rebuild of indexes can take a lot of time.

      So if you want the 1st case to occur, you make sure there are 2 opens of the same table in the code.

      The record append part of the append operation should always be faster than the record copy (except possibly for a small number of record copies), but the speed will be based upon the overhead of any initial queries and if there is an index rebuild.
      Regards,

      Ira J. Perlow
      Computer Systems Design


      CSDA A5 Products
      New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
      CSDA Barcode Functions

      CSDA Code Utility
      CSDA Screen Capture


      Comment


        #4
        Re: append current record II

        Ira:
        He is talking about one record, not several.

        Comment


          #5
          Re: append current record II

          Thanks, G, for the thoughtful response and some other alternatives.

          So, Ira, does the <TBL>.COPY_RECORD_TO() rebuild indexes if there is only one instance of the destination table open?

          ba

          Comment


            #6
            Re: append current record II

            Hi Bob,

            Originally posted by Bob Arbuthnot View Post
            ..does the <TBL>.COPY_RECORD_TO() rebuild indexes if there is only one instance of the destination table open?
            No. <TBL>.COPY_RECORD_TO() merely does an enter of an entire record in the destination table, resulting in some field rules being applied and an update to the index file with that record (just as an enter might).

            What Gabe said about the others methods being wrapper-type functions is incorrect. A record get/set/clone etc work on the entire record, as opposed to individual fields, and are not XBasic code.

            Alpha 5 methods (as opposed to functions) are never (as far as over 10 years of use and testing indicate) written in XBasic code, and are typically as fast as they could be given what they need to do.
            Regards,

            Ira J. Perlow
            Computer Systems Design


            CSDA A5 Products
            New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
            CSDA Barcode Functions

            CSDA Code Utility
            CSDA Screen Capture


            Comment


              #7
              Re: append current record II

              In the end, all roads lead to Malta, question is which one is the fastest.
              Any speed tests yet?

              Comment


                #8
                Re: append current record II

                Bob:

                So, Ira, does the <TBL>.COPY_RECORD_TO() rebuild indexes if there is only one instance of the destination table open?
                For some reason, Ira did not answer your question, so I will answer it:
                Yes it will re-build indexes, and if it does not, it should and that will happen regardless of what method you use.

                If you are looking for a method that will bypass the indexes: first you won't find one and second, if you find it do not use it.

                If you are looking for better performance, the answer is not to use some function or method that will not rebuild the indexes but rather to avoid indexes as much as possible.

                Comment


                  #9
                  Re: append current record II

                  Originally posted by G Gabriel View Post
                  For some reason, Ira did not answer your question, so I will answer it:
                  Yes it will re-build indexes, and if it does not, it should and that will happen regardless of what method you use.
                  I did answer the question. It does not rebuild indexes, it merely adds the new record to an index as any new Record being entered to a table does at save time (which adds exactly 1 index entry to each index that needs to be updated, a Btree structure, taking typically less than 1 millisecond on a typical network)

                  An Index rebuild deletes all indexes attached to the table and rebuilds the btree structure for every record in the table, not the 1 record being saved.

                  This has been true for all DBF file formats since the beginning of the DBF format!
                  Regards,

                  Ira J. Perlow
                  Computer Systems Design


                  CSDA A5 Products
                  New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                  CSDA Barcode Functions

                  CSDA Code Utility
                  CSDA Screen Capture


                  Comment

                  Working...
                  X