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

Fastest Method of Adding New Record to A form and Posting Data to New Record

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

    Fastest Method of Adding New Record to A form and Posting Data to New Record

    Seeking assistance from the A5 gurus.

    I have a POS software that I've been developing over the past 5 years, and I still can't find a method of adding new records to my invoices without a noticeable delay.
    for much of this time, I thought the delay was related to the querying of the desired product after scanning. Now, I realize that the query is run fast enough to be considered acceptable. The real delay is, the time it takes to add a new record to the "Invoice Items" table and post the data to it from the "Products" table. Below is the code I'm using:

    Invoice form is based on a set comprising of:
    "Invoice Header" table
    "Invoice Items" table
    other tables like: Company, Customers, etc.

    Form name: POS
    Invoice Items browse: Invoice_items_b



    :POS:Invoice_items_b.new_record()
    :POS:Product_id.value = eval("products->Product_Id")
    :POS:Item_num.value = eval("products->Item_Num")
    :POS:Price.value = eval("products->Un_Price")
    :POS:Pricewithtax.value = eval("products->T_Price")
    :POS:QUANTITY.Value = eval("If(Var->vReturnMode = .F., 1, -1)")
    :POS:Qty_before.value = eval("products->Qty_Onhand")
    :POS:Invoiceitems_dept_id.value = eval("products->Dept_Id")
    :POS:Invoiceitems_department.value = eval("products->Department")
    :POS:Invoiceitems_shift_id.value = eval("Var->Current_Shift")
    :POS:Invoiceitems_cashier_id.value = eval("user_name()")
    :POS:SOLD_FROM.Value = "Shelf"
    :POS:Invoiceitems_date.value = eval("date()")
    :POS:Invoiceitems_time.value = eval("Now()")
    :POS:Invoiceitems_status.value = eval("'Open'")
    :POS:Invoiceitems_company_id.value = eval("'0'")

    Basically, each time a product is scanned, or manually entered by the cashier, the "Product_Lookup" form query the desired product, once found, a new record is added to the invoice and the above info is added to this new record before the software waits for further instructions from the cashier.
    The time it takes to complete the process is always longer than the time it takes the cashier to put the product down, pick up the next product and scan it. When I go to other stores, I see their softwares move faster than the cahier, but, my cashier is always waiting on my software to complete.

    Help please!!!!!

    #2
    Re: Fastest Method of Adding New Record to A form and Posting Data to New Record

    Just some thoughts: is there an index for the table that is used for the product lookup?
    I do not believe you need to be using the eval() function which might be slowing things down.
    You appear to be working with the form. I'm thinking that maybe if you did all your computations using xbasic
    and manipulated the underlying tables, then refreshed your form might not be faster.
    Alpha 5 Version 11
    AA Build 2999, Build 4269, Current Build
    DBF's and MySql
    Desktop, Web on the Desktop and WEB

    Ron Anusiewicz

    Comment


      #3
      Re: Fastest Method of Adding New Record to A form and Posting Data to New Record

      Can some of the data be held as variables?
      Examples = Shift, Date, Company Id etc?
      That might speed things up if there are some defaults like these.
      See our Hybrid Option here;
      https://hybridapps.example-software.com/


      Apologies to anyone I haven't managed to upset yet.
      You are held in a queue and I will get to you soon.

      Comment


        #4
        Re: Fastest Method of Adding New Record to A form and Posting Data to New Record

        Nigel,
        In addition to the use the underlying tables and refreshing try the <tbl>.batch_begin()/end() method. This might
        not be appropriate depending on your network considerations but it can make a MAJOR difference.

        Comment


          #5
          Re: Fastest Method of Adding New Record to A form and Posting Data to New Record

          To utilize the tables that are open with the form for data entry, take a look at change_record() and enter_record()
          Robin

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

          Comment


            #6
            Re: Fastest Method of Adding New Record to A form and Posting Data to New Record

            To speed up data entry I would try a simpler set than described. Invoice_header one to many to invoiceitems to products. The original set can still be used for reporting. If that approach does speed things up I would then try another set without products as a grandchild and use lookupc() and lookupn() to derive the appropriate values from the product table.
            Last edited by Stan Mathews; 04-09-2018, 08:07 AM.
            There can be only one.

            Comment


              #7
              Re: Fastest Method of Adding New Record to A form and Posting Data to New Record

              Thanks to everyone for their suggestions. I will proceed with all suggested, and update you afterwards.
              Thanks again.

              Comment


                #8
                Re: Fastest Method of Adding New Record to A form and Posting Data to New Record

                Nigel, I actually did something similar quite a few years ago. After looking at the app, it turns out what I did most follows Stan's suggestion. I have a header table and a one-to-many items table. I did use lookup functions to populate the items table. The app is far too complex, too many moving parts, for me to describe hear. But there is no lag.
                Alpha 5 Version 11
                AA Build 2999, Build 4269, Current Build
                DBF's and MySql
                Desktop, Web on the Desktop and WEB

                Ron Anusiewicz

                Comment


                  #9
                  Re: Fastest Method of Adding New Record to A form and Posting Data to New Record

                  I think maybe I have too many calculations going on on the form.

                  Comment


                    #10
                    Re: Fastest Method of Adding New Record to A form and Posting Data to New Record

                    Nigel,

                    Not sure if this could help but you may want to try this. It may show you a bottleneck.


                    PROFILER_BEGIN()

                    Description

                    Insert the PROFILER_BEGIN() command in an Xbasic script at the point that you want to begin profiling a script. Insert the PROFILER_END()command at the point that you want to end profiling a script. When the PROFILER_END() command is encountered, Alpha Five dumps a report to the Trace window showing each line in your Xbasic script that was executed, the number of times it was executed, and the time taken to execute the command.

                    Profiling a script can help you determine which parts of a script might be taking a long time to execute. It can also help you debug your script because in complex scripts with lots of loops and branches, it can be difficult to see exactly which lines in your script actually get executed. The profiler report shows you what got executed.

                    Examples

                    Assume that you have created this script:
                    Code:
                    profiler_begin()
                    t = table.open("customer")
                    t.fetch_first()
                    while .not. t.fetch_eof()
                        t.change_begin()
                        t.Company = upper(t.Company)
                        t.change_end(.T.)
                        t.fetch_next()
                    end while
                    
                    t.close()
                    
                    profiler_end()

                    After running this script, the Trace window will show:

                    Script profiler
                    Line Tot Time Cnt Source
                    ========================================================
                    1 0.014018 1 t = table.open("customer")
                    2 0.000228 1 t.fetch_first()
                    3 0.000256 1 while .not. t.fetch_eof()
                    4 0.008717 63 t.change_begin()
                    5 0.009599 63 t.Company = upper(t.Company)
                    6 0.240749 63 t.change_end(.T.)
                    7 0.007564 63 t.fetch_next()
                    8 0.004301 63 end while
                    9 0.001136 1 t.close()
                    =======================================================
                    Alpha 5 Version 11
                    AA Build 2999, Build 4269, Current Build
                    DBF's and MySql
                    Desktop, Web on the Desktop and WEB

                    Ron Anusiewicz

                    Comment


                      #11
                      Re: Fastest Method of Adding New Record to A form and Posting Data to New Record

                      Just a thought.
                      I do calcs on automotive finance that has to be to the penny. The form I use in all cases are made up of variables. Those vars are then used in scripts and UDF's for calculating and rendering answer vars which are displayed on the form and written to underlying tables in a set. After trying this with table fields and having speed issues, the variavles used as fields on the form were like lightning.
                      Dave Mason
                      [email protected]
                      Skype is dave.mason46

                      Comment

                      Working...
                      X