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

Index updating while shared

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

  • Index updating while shared

    It is well known that updating a CDX of a table needs to be done while having exclusive access to a table. I don't know if there is a way around this, but if there is, I would love to know about it.

    What occurred to me is that while many users are in a certain table, adding and editing records, the added ones are having their indexes updated while not having exclusive access. I wonder why it works this way but does not enable separate updating of the CDX while another session is open.

    I noticed one way to get around this is to copy the DBF and CDX somewhere else, open it exclusively, update the CDX, then copy the CDX back to the original location. This results in a de facto updating of the CDX while other users are in. Sure, there are risks if anyone was about to add a new record when you removed the DBF and CDX, but I'm thinking more about a situation where you want to update the CDX in off hours but someone(s) left the table open on their desktop. If you can't force that session closed, then the technique of copying back the CDX after separately updating it elsewhere is a way.

    My question is whether there is an easier way to handle this situation. That is, someone on the network has a table open, and you want to update the index file. I can understand why you would not be able to, say, restructure the table in this situation, but again, if a CDX can update itself while several users are open and a user adds a record, why not have the ability to separately update the CDX while multiple sessions are open.

    Thank you if you have insight into this.

    Jeff Fried

  • #2
    Re: Index updating while shared

    No one else has jumped in so I'll give you my take.

    While in use in a multiuser setting the indexes are kept current by modification of individual record keys in the cdx. Much as two users can't make changes to the same record at the same time, two users can't be doing anything that would change a record's index values.

    When you update or reindex, the entire cdx is rebuilt requiring exclusive use.
    There can be only one.

    Comment


    • #3
      Re: Index updating while shared

      Stan,

      That makes sense. Essentially only one user can be editing a specific record, thereby giving exclusive use to that one record and thereby enabling the index update that affects that one record within the CDX, whatever the particular index tags are. However, making the entire file exclusive needs everyone else out of the table.

      I guess there's no solution to updating the CDX while someone else has that table open, whether they are using it or not. I guess by definition if it's open, it's open on one of the records.

      Thanks for the insight.

      Jeff

      Comment


      • #4
        Re: Index updating while shared

        I was curious if anyone else had thoughts on this. I am having problems using dbcount() and it is due to the index not being up to date. Except after closing, I have no acess to an exclusive mode and it seems to take quite a while for the index to correct itself. I can see the records that someone has entered, but the dbcount is inaccurate for hours at times.

        Comment


        • #5
          Re: Index updating while shared

          Hi John,

          If you can't get exclusive access, you can't update the indexes. You can use tablecount() which does a filter (and might use an index if LQO is available on an index with the right filter expression).

          But indexes don't normally fail in a properly designed application and with good hardware. If you have bad indexes, the problem is elsewhere, this is just a symptom. You can update indexes after hours and they should stay good forever, however, bad hardware on 1 or more systems will bring them down for everyone.

          But other than the count, how do you know you have a problem?

          To monitor an index, go to A5 control panel, and right-click on a table, go to utilities, then choose Check Indexes at regular intervals (this will slow use of that table to others). My guess is that your errors are occurring much earlier than you realize.

          I suggest you read my Alpha Five Data & Index Corruptions tips
          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


          • #6
            Re: Index updating while shared

            I dont know if it is an index problem exactly. With my discussions with Alpha they indicated that it was a refresh issue with the index and the fact that there is some sort of local copy of the index. I have a browse on a form and a 2nd browse which is a one to many for the records in the primary browse. I need to display in the primary browse the number of records in the child browse. dbcount seemed to work, but the update results throughout the network is spotty. I have been trying to use tablecount but this seems to put the same value in each entry of the primary browse. So I do not think the indexes are bad, but something is happening on each local machine to not have dbcount function. The form is on multiple computers all day as it is a dynamic schedule, so network updates are important.

            Comment


            • #7
              Re: Index updating while shared

              I have been trying to use tablecount but this seems to put the same value in each entry of the primary browse.
              Tablecount() will yield the same result as dbcount() if the filter for the tablecount() is properly specified. If you don't get the same result......... your filter is incorrect.
              There can be only one.

              Comment


              • #8
                Re: Index updating while shared

                Hi John,

                Originally posted by johngtatp View Post
                I dont know if it is an index problem exactly. With my discussions with Alpha they indicated that it was a refresh issue with the index and the fact that there is some sort of local copy of the index.
                For Alpha to work properly on a shared database on a network, there can not be a local copy of an index (this would be effectively called caching), as well as the data and memo files. If there is caching, performance will become awful as soon as you data is any real size, but the results should still be correct. There are settings on your server that enable this caching and they should be disabled for the Alpha data files, indexes and data dictionary file extensions.

                If Alpha Software was talking about a query being out-of-date, it would have to be refreshed on the client system, but DBCOUNT() only uses indexes, not queries. TableCount() can use indexes (via LQO) or queries.

                Otherwise there is no need to rebuild indexes per say, you have some other issue. What you described that Alpha said can not be correct as stated based upon my experience. Best course would be to post a simplified example of your application, so we can see what the expressions are doing.
                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


                • #9
                  Re: Index updating while shared

                  Interesting... Our network is fairly simple and the "server" is just a network storage device that all computers are mapped to. How could you turn off caching on the individual work station and assure that the only index being used is the one on the network?

                  Comment


                  • #10
                    Re: Index updating while shared

                    John, tell us a bit about how you're using dbcount(). Is it in some sort of a calc field that you are expecting to keep updated in real time throughout the day?

                    I'd be surprised if dbcount() gives you the wrong result on a button push. However, I'd be surprised if keeping the calc field current in real time when others are updating the table from different work stations isn't very very difficult. If real time counting is the goal, no matter when or where the records are entered, then I'd look for an alternative solution. First thought here is that I'd keep a running count in a table. As each record is entered the counter field gets incremented by each work station. Then simply display and refresh the running count field from the counter control table.

                    Comment


                    • #11
                      Re: Index updating while shared

                      Hi John,

                      Originally posted by johngtatp View Post
                      Interesting... Our network is fairly simple and the "server" is just a network storage device that all computers are mapped to. How could you turn off caching on the individual work station and assure that the only index being used is the one on the network?
                      Only "modern" windows have caching of files from the server. Windows 7, Windows server 2003, Windows Server 2008 etc. But I really doubt this is your problem. As I said before, caching or no caching, the value would still be 100% correct, just much slower with caching. I'm sure it's how you specify the DBCOUNT().
                      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


                      • #12
                        Re: Index updating while shared

                        Tom,

                        Basically I created a schedule board. By and large it is working great and I have a huge buyin by all the staff. I have about 4 Customer Service folks who enter data and keep one form up all the time. The form has a browse which shows all of the arriving and departing flights. Underneath is the detail for each of the records, and where they edit the data. There is another one to many browse below which is each rental car associated with an aircraft arrival. I need to count how many rental cars are associated and display it in the primary browse. In another building there is a large TV monitor which only has the browse portion for display only. The Form for the TV monitor does a refresh as an ontimer event and the dbcount seems to work fine. For the other 4 computers I have the network refresh set at 15 seconds and it will also resync if a button is pressed, If I used the ontimer event, one of the things I needed to do is have a goto first record to make sure it updates, this could throw off a user if they were editing. As data is entered on the other computers the count is off at times and I am having a hard time nailing down what is causing this. I tried to use the button to do a refresh but the count was still wrong.

                        I am quite happy with how this functions so far, but as this is my foray into a network app, and I am having difficulties.
                        Attached Files

                        Comment


                        • #13
                          Re: Index updating while shared

                          Originally posted by csda1 View Post
                          Hi John,



                          Only "modern" windows have caching of files from the server. Windows 7, Windows server 2003, Windows Server 2008 etc. But I really doubt this is your problem. As I said before, caching or no caching, the value would still be 100% correct, just much slower with caching. I'm sure it's how you specify the DBCOUNT().
                          Ira,

                          The code does seem to work most of the time, it is when another user updates the table that should then change the count. If is does not update as it should, if you hit a button that should refresh/resync, it does not. As soon as you reboot alpha and bring the form back up it works. I am not sure where this is coming from.

                          Comment


                          • #14
                            Re: Index updating while shared

                            Hi John,

                            Originally posted by johngtatp View Post
                            The code does seem to work most of the time, it is when another user updates the table that should then change the count. If is does not update as it should, if you hit a button that should refresh/resync, it does not. As soon as you reboot alpha and bring the form back up it works. I am not sure where this is coming from.
                            You're not listening. Where and what is being used!?? Show us the expression. Tell us where are you using it? Is it a calculated field on the form, a calculated field in a field rule, XBasic code, WHAT? DBCOUNT() only looks at the values that have been saved. If item is being entered for the 1st time, it doesn't exist as a record that DBCOUNT() can see until it is saved. Changes are not seen either until they are saved.
                            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


                            • #15
                              Re: Index updating while shared

                              Ira,

                              Sorry, I am not a programmer by any stretch of the imagination and I did not understand what you were getting at.

                              The code is a calculated field on a form,
                              The formula is:
                              numrentcars = dbcount("rcardetail","resnum_type",*concat_keys(resnum,type))
                              The resnum_type index has an order expression of *CONCAT_KEYS(RESNUM,TYPE) with no filter

                              The numrentcars is displayed in a embedded browse

                              All users have this form open and have the network refresh set every 15 seconds. When one user saves a record which should update the count, the other machines sometimes reflect the change and sometimes do not. If you restart alpha (not just close and open the form) the correct count is always displayed. I have also tried using a button that has an action script to refresh the display which in xbasic is:
                              topparent.Commit()
                              topparent.Resynch()
                              topparent.Refresh_Layout()
                              but that does not refresh the count when it is incorrect. I hope that makes sense.

                              Comment

                              Working...
                              X