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 corrupts after table grows too large, unlesss all keys are uppercase

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

    Index corrupts after table grows too large, unlesss all keys are uppercase

    I recently added a new table called "inventory_trans" to my organization's database as part of an inventory tracking system. Whenever a user action elsewhere in the database creates a change in the current stock level, a record denoting the amount of change is entered in this table, which automatically posts to another table that contains the running total for each item we are tracking. All normal data entry to this table is done via Xbasic; only rarely will anyone enter a record directly.

    I had this system up and running for about three weeks without a hint of trouble. The table grew to about 4300 records, no problem. Then one day I made a few changes at once: 1) I added a new posting field rule. 2) I added two filtered indexes to the table to accommodate the new rule. The system also automatically added a new index that was unfiltered with "recno()" as the order expression. 3) I ran a script which added over 17,000 records to the table, bringing the total up to more than 21,000 records. Instantly, I began getting EXTREMELY frequent messages saying that the indexes on this table had been corrupted. When I say extremely frequent, I mean that I was lucky to get 5 records entered before the message would show up again, even when entering manually into the default browse.

    I suspected the new field rules, so I reverted to the old ones. No help. I read enough on this forum to think that the filtered indexes were the problem, so I deleted them. Still no help. I thought maybe it was a shadowing problem, since my development copy worked fine, but it was direct. No help there, and I shadowed my dev copy and it still worked fine. I checked over all the Xbasic that modified the table, & couldn't find any logical errors. I threw in a few "wait-for-idle" commands between the record entries just in case I was entering new records too quickly, but still no help. I deleted and rebuilt the indexes. Still no help.

    Then I realized that my dev copy had significantly fewer records than my live copy. I copied the live data to the dev copy, and it instantly broke as well. So, now what? Back to the forums...after hours of searching I found a tiny little mention deep in one thread that someone else had consistent trouble with one table's indexes until he converted all the indexed fields to uppercase. I thought that was a bit far-out, but I tried it anyway. Presto! Everything works.

    So my question is, WHY does my table exhibit this behavior? Is there some documented reason why the index keys need to be uppercase? How will I know if circumstances are right for this issue to crop up in the future? It seems to me that it's a flaw in the indexing algorithm, but maybe I'm missing something.

    Here's the specifics on the table:

    TABLE NAME:
    Inventory_trans

    FIELDS:
    Item_ID (C, 8)
    Date (D, 8)
    Trans_Qty (N, 6.0)
    Trans_Type (C, 1)

    INDEXES:
    Item_ID (Filter: none. Order: Item_ID, Ascending, All)
    Itembydate (Filter: none. Order: Item_ID+cdate(DATE), Ascending, ALL)
    Recno (Filter: none. Order: recno(), Ascending, All)

    The indexes I deleted were:
    Verified (Filter: TRANS_TYPE="V" Order: Item_ID+cdate(DATE), Ascending, All)
    Unknown (Filter: TRANS_TYPE="U" Order: Item_ID+cdate(DATE), Ascending, All)

    Item_ID may contain a number string (such as "1845"), mixed letters and numbers (such as "CD1845"), all letters (such as "CDSLVBLK"), letters & hyphens (such as "CD-R-VAL"), or letters, numbers, and hyphens (such as "2CD-CRYS"). This was the field I converted to uppercase in order to make the indexes work.

    Any clues? Thanks in advance...

    ~Jason

    #2
    Re: Index corrupts after table grows too large, unlesss all keys are uppercase

    Hmmm...Maybe my first post was too long. :) Has anyone else experienced this issue with lowercase characters in an index for a moderate-sized table? Any clues?

    ~Jason

    Comment


      #3
      Re: Index corrupts after table grows too large, unlesss all keys are uppercase

      Nope. Haven't seen this, ever. I'd be inclined to think there's something wrong in the data itself. Characters the index can't handle because not allowed in DBF format, maybe.

      Don't know your app, obviously, but I were indexing items by date, the date component would be first, and the item second. i.e. cdate(my_date_field) + item_id, instead of the way you have it now.

      Also, I think it's bad practice to use fieldnames that match function names. "Date" is not a fieldname I'd use in my tables. DATE() is a built in function.

      -- tom

      Comment


        #4
        Re: Index corrupts after table grows too large, unlesss all keys are uppercase

        Is the hyphen permitted in a DBF? To my knowledge, that's the only non-alphanumeric character used in the table. I still find it strange that merely running an update operation using UPPER() would correct characters that aren't permitted.

        Thanks for the tip on the name of the date field. If I were building the table over again, I'd name it something else, but I doubt it's worth changing now that most development is done?

        And about the index, you're right, most of the time that's the way it's done. But in this case I'm more interested in seeing what happened to a particular item, than what happened on a particular day.

        Thanks for the time.

        ~Jason

        Comment


          #5
          Re: Index corrupts after table grows too large, unlesss all keys are uppercase

          Originally posted by Juniper View Post
          To my knowledge, that's the only non-alphanumeric character used in the table.
          3) I ran a script which added over 17,000 records to the table, bringing the total up to more than 21,000 records.
          What was the source of the 17000 records?
          There can be only one.

          Comment


            #6
            Re: Index corrupts after table grows too large, unlesss all keys are uppercase

            While some systems accept upper and lower case characters(ie letters of the alphabet) as unique values in an index, Alpha doesn't.

            I've overcome that by converting the data in the field into a lager field with the ascii value of each character replacing the original character. You end up with a unique value in a 2 to 3 time longer field.

            Like Stan asked, where does this data come from?

            You should import the data into Alpha into a plain vanilla intermediate table. No field rules/checking - and then analyze what you have in those fields...
            Al Buchholz
            Bookwood Systems, LTD
            Weekly QReportBuilder Webinars Thursday 1 pm CST

            Occam's Razor - KISS
            Normalize till it hurts - De-normalize till it works.
            Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
            When we triage a problem it is much easier to read sample systems than to read a mind.
            "Make it as simple as possible, but not simpler."
            Albert Einstein

            http://www.iadn.com/images/media/iadn_member.png

            Comment


              #7
              Re: Index corrupts after table grows too large, unlesss all keys are uppercase

              Hi Stan,

              Wow, that's a long story but I'll try to keep it short. In essence, the contents of the ITEM_ID field for each of those 17,000 records came from one of two tables: "cassettes" and "consumables". "Cassettes" is our products table; it shouldn't be called cassettes anymore but I can't change that now. "Consumables" contains the items we use to make our products. The script I ran examined all of our invoices for the last year and entered a summarized version of the records that would have been entered in the inventory_trans table if the system had been running for the last year. (This was so that my statistical calculations would be accurate from the get-go instead of waiting 'til next year) For both of the source tables, the field I copied to ITEM_ID was an 8 character field with the same type of contents I described for ITEM_ID in my first post above. No non-alphanumerics except the hyphen.

              Al,

              Thanks for the tips. I don't mind that Alpha treats upper and lower characters as the same. But I'm trying to figure out why the index file actually corrupted when lowercase characters were present in the table data.

              Thanks to all!
              ~Jason

              Comment


                #8
                Re: Index corrupts after table grows too large, unlesss all keys are uppercase

                Originally posted by Juniper View Post
                Al,

                Thanks for the tips. I don't mind that Alpha treats upper and lower characters as the same. But I'm trying to figure out why the index file actually corrupted when lowercase characters were present in the table data.

                Thanks to all!
                ~Jason
                I won't worry about that message as much as putting the data in so the system works.
                Al Buchholz
                Bookwood Systems, LTD
                Weekly QReportBuilder Webinars Thursday 1 pm CST

                Occam's Razor - KISS
                Normalize till it hurts - De-normalize till it works.
                Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                When we triage a problem it is much easier to read sample systems than to read a mind.
                "Make it as simple as possible, but not simpler."
                Albert Einstein

                http://www.iadn.com/images/media/iadn_member.png

                Comment


                  #9
                  Re: Index corrupts after table grows too large, unlesss all keys are uppercase

                  Thanks to all for the responses. Just for the record, the app ran perfectly after the fix I described, until yesterday a record with a lowercase ITEM_ID slipped in because a field rule wasn't honored. Guess what? The dreaded "Indexes have become corrupted" message reappeared. I manually changed the offending record to uppercase and the system's back to working smoothly. So whatever the root of the problem is, it really is directly affected by lowercase characters. Strange...

                  Again, thanks to all for the tips and comments. I'm still curious why things are working the way they are, but since the system's operating fine with the present "workaround," I won't take your time with further questions.

                  ~Jason

                  An afterthought: The exact value of the field I referred to above was "CD-Poly" which I changed to "CD-POLY".

                  Comment


                    #10
                    Re: Index corrupts after table grows too large, unlesss all keys are uppercase

                    Doesn't make any sense to me that you are having the trouble you describe because of an upper/lower case issue. (Not doubting you, just mystified)

                    Can you duplicate the table under a new name, empty the duplicate, and attach it here for us to see?
                    There can be only one.

                    Comment


                      #11
                      Re: Index corrupts after table grows too large, unlesss all keys are uppercase

                      Originally posted by Juniper View Post
                      So whatever the root of the problem is.
                      A bug.
                      Didn't expect it to, but it's a bug in Excel as well.
                      I'd submit a bug report and won't hold my breath for a fix.

                      Comment


                        #12
                        Re: Index corrupts after table grows too large, unlesss all keys are uppercase

                        Stan,

                        See attached. There's nothing confidential in the data, so if you want the original table you can have it. I have also attached an emptied copy of the table referenced in the field rules, just in case you need it. The original name of the first table is Inventory_Trans. The original name of the second table is Inventory. Also, remember that I never had any trouble until my record count exceeded about 20,000 or so.

                        Gabe,

                        Have you experienced this before, or how are you sure it's a bug?

                        Thanks to all!
                        ~Jason

                        Comment


                          #13
                          Re: Index corrupts after table grows too large, unlesss all keys are uppercase

                          Always fun trying to understand someone else's process.

                          One observation. In the field rules for the inventory table you have the hide_rec field as required and it has a default expression. I believe that to be redundant - not needing the required designation.

                          Question: In the inventory_trans table you have a posting field rule for the date and trans_qty fields. Does the onsaverecord event script do the same thing? Hard to follow.

                          Also missing the inventory_trans_types table.
                          There can be only one.

                          Comment


                            #14
                            Re: Index corrupts after table grows too large, unlesss all keys are uppercase

                            Code:
                            ?sortsubstr("A,a,G,g,g,a,d,D",",","A")
                            = "a,a,A,d,D,g,g,G"
                            'Correct Answer
                            
                            ?sortsubstr("A,a,B,b,D,d,D",",","A")
                            = "a,A,b,B,d,D,D"
                            'Correct Answer
                            
                            ?sortsubstr("A,a,B,b,b,D,d,D",",","A")
                            = "a,A,b,b,B,d,D,D"
                            'Correct Answer
                            
                            ?sortsubstr("a,A,a,B,b,b,D,d,D",",","A")
                            = "A,a,a,B,b,b,d,D,D"
                            'Really?
                            
                            ?sortsubstr("1,6,5,7,a,A,a,B,b,b,D,d,D",",","A")
                            = "1,5,6,7,a,A,a,b,b,B,d,D,D"
                            'Really
                            'Try same in Excel

                            Comment


                              #15
                              Re: Index corrupts after table grows too large, unlesss all keys are uppercase

                              Sorry,..I had it backwards when I referred to those as being correct answer.. they are not.
                              Here is another example:
                              Code:
                              ?sortsubstr("a,A,b,c,B,C,d,D,D",",","A")
                              = "A,a,b,B,C,c,D,D,d"
                              Correct answer should be:
                              A,a,B,b,C,c,D,D,d
                              Last edited by G Gabriel; 02-04-2011, 07:38 AM.

                              Comment

                              Working...
                              X