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

Indexes removed and renamed

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

  • Indexes removed and renamed

    During the normal use of the application, some indexes are removed.

    1-What can cause the indexes delete?

    2-Is there a procedure to work with indexes?

    3-Also some indexes are automatic renamed, and that cause an error when the index is called by the name.
    Is there a way to solve the rename problem?

    4- To try to deal with the delete and rename problem, I created a script to check indexes and create again if it is needed.
    This script is called in autoexec, but we have problems to run this script in the shadow.
    This is a high level function using indexes, first I tried a low level procedure using tbl.index_tag_add.
    Anyone use a similar approach for this kind of problems?


    Code:
    ' Reference: http://wiki.alphasoftware.com/~alphafiv/INDEXES_MATCH_DEFSTRING+Function
     
    dim indexDef as C
    dim matchIndex as P
     
    ' 1- Check indexes in subsc_charged_items table
     
    'indexDef = get_index_definitions("subsc_charged_items") 
    indexDef = <<%txt%
    AUTO_NO|AUTO_NO||
    AUTO_NO1|AUTO_NO||U
    INV_REC|INV_REC+CHARGE_TYPE||
    SUB_AUTO_N|SUB_AUTO_NO+CHARGE_TYPE+THIS_CHAR||
    SUB_REF|SUB_REF|ISBLANK("INV_REC")|
    SUB_REF1|SUB_REF+THIS_CHAR+CHARGE_TYPE||
    SUB_REF2|SUB_REF||D
    SUB_REF3|SUB_REF||
    SUB_REF4|SUB_REF+CHARGE_TYPE+THIS_CHAR||
    THIS_CHAR|SUB_REF+CHARGE_TYPE+THIS_CHAR+SERV_TYPE||D
    __A5_RECORD__|RECNO()||
    %txt%
     
    matchIndex=indexes_match_defstring("subsc_charged_items", indexDef)
    if matchIndex.Error=.F. .or. matchIndex.AdditionalIndexTags<>"" .or.  matchIndex.MissingIndexTags<>""
                Create_Indexes("subsc_charged_items", indexDef) 
    end if

  • #2
    Re: Indexes removed and renamed

    What can cause the indexes delete?
    If Alpha can not evaluate the expression used in the index, the index will be dropped.
    There can be only one.

    Comment


    • #3
      Re: Indexes removed and renamed

      Is there a procedure to work with indexes?
      Question is unclear.
      There can be only one.

      Comment


      • #4
        Re: Indexes removed and renamed

        An indextag will be deleted automatically if it cannot be evaluated at run time.

        I avoid indextag names that end in a number. If Alpha needs to create an index for your application it will often create a tag name that ends in a number. I don't know for certain whether this could create a naming conflict, but I see the potential and avoid it.

        Comment


        • #5
          Re: Indexes removed and renamed

          Also some indexes are automatic renamed, and that cause an error when the index is called by the name.
          Is there a way to solve the rename problem?
          Unlikely any indexes are renamed. More probable that an index is dropped as mentioned earlier and a new one is created automatically as needed for a set linkage, etc.
          There can be only one.

          Comment


          • #6
            Re: Indexes removed and renamed

            One suggestion might be to try your script in the onactivate event for your forms (or maybe an ontimer event) but instead of

            Create_Indexes("subsc_charged_items", indexDef)

            simply throw up a message box alerting the user that the indexes are corrupt and have them note what they were doing immediately prior to seeing the message.

            Might help you track down the cause.
            There can be only one.

            Comment


            • #7
              Re: Indexes removed and renamed

              This was problematic for me in a very large application with a part information table. It would happen sporatically EVEN when there was no reason for it go belly up. (There was no reason for the evaluation to fail.)

              Because the application was so large, and used by 30 users a day, I was never able to track down the root cause, if there actually was one on my end.

              As the only solution possible, I created a script that used .index_name_get(), .index_create_begin() and .index_add() to recreate any missing indexes.

              The downside is you must have FILE_RW_EXCLUSIVE set when opening the table before the script will proceed.

              Frankly, I would rather see an error message telling the reason the index failed, rather than a random restructuring. It a little like an error in a script erasing the script.

              From version 9 on, I resolved never to use the suite of LOOKUP() functions for that very reason.

              Comment


              • #8
                Re: Indexes removed and renamed

                Stan:

                Do you know if create_indexes() works when the table is open??? Usually, the table must be closed when new indexes are created...

                Craig

                Comment


                • #9
                  Re: Indexes removed and renamed

                  Craig, I tested the script with a open table and it created the indexes.

                  Comment


                  • #10
                    Re: Indexes removed and renamed

                    Wow! That's great!

                    Thanks!

                    Comment


                    • #11
                      Re: Indexes removed and renamed

                      Is there a procedure to work with indexes?
                      We are using 3 indexes that we have given a custom name.
                      We are only having problems with one of them.
                      I wonder what is different.

                      It is there a way to do a lookup without using indexes (even if it is slower) ?

                      Comment


                      • #12
                        Re: Indexes removed and renamed

                        I most commonly open the table, and set a query. Definitely slower, but more stable.

                        That will probably change, now, based on this thread.

                        Of course, rebuilding indexes at run time may also slow things down, but only if that has to happen.

                        It says create_indexes() came out with version 6. Somehow, I missed the possibility that you might no longer need exclusive access...

                        ex:

                        payments_tbl = table.open("payments")

                        query.order = "Paydate"
                        query.filter = "paydate >= var->begin_date_d_v .and. paydate <= var->end_date_d_v" query.flags = ""
                        query.flags = ""

                        indx1 = payments_tbl.query_create()

                        record_count_1 = indx1.records_get()

                        etc...

                        Comment


                        • #13
                          Re: Indexes removed and renamed

                          Turns out create_indexes() isn't in the local copy of version 9's help file. At least I don't feel so bad, now.

                          Comment


                          • #14
                            Re: Indexes removed and renamed

                            my experience is that when a table is open I cannot recreate indexes
                            a number of years ago Selwyn can up with a script that would read all the current indexes and save it to a text file - and then a way to read the text file and recreate the indexes - I modified and keep the indexes in a memo field in a table - works great

                            The issue Stan mentioned - that where you have an expression (as when creating a query) and Alpha cannot create the query using the expression, it will delete the respective indexes - has been around since 1998, at least.

                            Unfortunately, I know of no way to automatically determine what expression is causing the problem - extensive testing in a development copy would work, but be very time consuming - like run one of you scripts or query's, then see if it is still there.
                            Cole Custom Programming - Terrell, Texas
                            972 524 8714
                            martin_w_cole@msn.com

                            ____________________
                            "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

                            Comment


                            • #15
                              Re: Indexes removed and renamed

                              I tested the same and it does not create the indexes. It doesn't throw an error message, just fails.

                              list = Get_Index_Definitions("aa")
                              ? list
                              = ID|ID||U
                              TEST|NAME||
                              __A5_RECORD__|RECNO()||
                              'go to the table, delete the indexes, save, open a browse of the table
                              ? create_indexes("aa",list)
                              = ErrorText = ""
                              HasError = .T.
                              There can be only one.

                              Comment

                              Working...
                              X