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

'<tbl>.index_primary_put' not working

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

    '<tbl>.index_primary_put' not working


    Hi!
    I wrote an Patient Administration-Application for for an Animal Hospital.
    Now I have the following problem:
    I would like to change the Primary index of a other Table ("patient")
    via 2 Buttons:
    Xbasic on Button 1:
    t = table.open("patienten")
    i = t.index_primary_put("Abteilung_Haut")
    t.close()
    Xbasic on Button 2:
    t = table.open("patienten")
    i = t.index_primary_put("Abteilung_Knochen")
    t.close()
    Readout of Index returns nothing:
    t = table.open("patienten")
    iget = t.index_primary_get()
    name = iget.name_get()
    trace.WriteLn("Primary index = " + name)
    t.close()
    or
    t = table.open("C:\OP\Anwendung\patienten.dbf")
    iget = t.index_primary_get()
    name = iget.name_get()
    trace.WriteLn("Primary index = " + name)
    t.close()
    Where is my error? Please, can somebody help me?
    Many thanks
    Michael


    ENGLISH:
    Ich habe eine Anwendung zur Patientenverwaltung f&uuml;r eine Tierklinik geschrieben.
    Nun habe ich folgendes Problem:
    Ich m&ouml;chte mittels 2 Buttons den Primary Index eines fremden Tables ("patienten") &auml;ndern:
    Xbasic auf Button 1:
    t = table.open("patienten")
    i = t.index_primary_put("Abteilung_Haut")
    t.close()
    Xbasic auf Button 2:
    t = table.open("patienten")
    i = t.index_primary_put("Abteilung_Knochen")
    t.close()
    Noch nicht mal das Auslesen des aktuellen Index funktioniert:
    t = table.open("patienten")
    iget = t.index_primary_get()
    name = iget.name_get()
    trace.WriteLn("Primary index = " + name)
    t.close()
    oder
    t = table.open("C:\OP\Anwendung\patienten.dbf")
    iget = t.index_primary_get()
    name = iget.name_get()
    trace.WriteLn("Primary index = " + name)
    t.close()

    Was mache ich falsch? W�re f�r Hilfe dankbar
    Vielen Dank schon mal...
    Michael



    #2
    RE: '&lt;tbl&gt;.index_primary_put' not working

    Michael,

    Only one index can be "primary" for a table at any one time. When you need to use a particular index for a table make it primary prior to fetching or navigating within the table. Do not assume that the last process which used the table left the desired index in place. Set it primary each time you want to use the table.

    I've always assumed the default index for any table is either the first indextag defined for the table, or the natural order of the records (record number sequence). However, there's never been a reason to study this. I choose not to ever use the "default" index, preferring instead to guarantee that the desired index is primary each and every time I use a table. (By explicitly setting that index primary for each instance of the table that I open.)

    I was able to reproduce the behavior you're seeing. However, I do not know if it's a problem with "index_pointer".name_get() or with our understanding of what it means to be "primary". It has never ever bothered me, since I always explicitly set the desired index each time I open a table. My own practice is to never ever assume that a previous process left the desired index as primary.

    -- tom

    Comment


      #3
      RE: '&lt;tbl&gt;.index_primary_put' not working

      Hi Tom!

      Thanks for your comment! This Project is my first Database Application (and my English is poor too).

      I only need one (Primary) Index at a time: The Table must be filtered either by Field Value "Haut" OR "Knochen", nothing more.

      That's my Indexes on the Table:

      Index Name : Order Exp : Filter Exp : Direction : Include
      ---------------------------------------------------------
      Abteilung_Haut : NAME : ABTEILUNG="Haut" : Descending : All
      Abteilung_Knochen : NAME : ABTEILUNG="Knochen" : Descending : All

      But how can i do that?
      I have read the A5 Manuals and i think i have understood the Sense of Indexing, but perhaps some basics are still missing to me.

      Thanks
      Michael

      Comment


        #4
        RE: '&lt;tbl&gt;.index_primary_put' not working

        What Tom is trying to tell you is

        t = table.open("patienten") 'opens the table
        i = t.index_primary_put("Abteilung_Haut") 'sets the prinary index for the duration of the script
        t.close() 'closes the table, the index is no longer primary

        Try

        t = table.open("patienten")
        i = t.index_primary_put("Abteilung_Haut")
        iget = t.index_primary_get()
        name = iget.name_get()
        trace.WriteLn("Primary index = " + name)
        t.close()

        In usage you would do this in a script

        t = table.open("patienten")
        i = t.index_primary_put("Abteilung_Haut")
        'statements here to process records
        'in "Abteilung_Haut" order
        t.close()

        When the script finishes, the table is no longer in "Abteilung_Haut" order.
        There can be only one.

        Comment


          #5
          RE: '&lt;tbl&gt;.index_primary_put' not working

          since you want to do this from a button, if you are doing this from a form based on a set and you are referencing the parent table for the form, or if not based on a set, the table the form is based on, you would say

          parentform.index_set("indexname")
          Cole Custom Programming - Terrell, Texas
          972 524 8714
          [email protected]

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

          Comment


            #6
            RE: '&lt;tbl&gt;.index_primary_put' not working

            Or, better yet, use .Index_SetVerify() in case the index is missing.

            This is especially important in this case due to the length of the index names and the way they are defined - Abteilung_Knochen and Abteilung_Haut. Since the first 10 characters are "Abteilung_" and a truncated index name would end up being 10 characters, if both index names did happen to get truncated and you tried to open the "Abteilung_Knochen" index, you would probably get the "Abteilung_Haut" index without warning instead because it would find the first "Abteilung_" index. If one of the indexes completely dissappeared, it would find and use the other index without warning. If both indexes disappeared, I'm not sure what it would use but it certainly wouldn't use the correct index and it wouldn't give you a warning either.

            Note the number of times "without warning" appears above!

            Since there isn't a built-in table method like .index_primary_putVerify(""), I even created my own method so I can always be sure the correct index is available. It's not an issue 99.99% of the time but that other .01% could create real problems.

            Cal Locklin
            www.aimsdc.net

            Comment


              #7
              RE: '&lt;tbl&gt;.index_primary_put' not working

              Ok, I have tried and understood. Thanks for this Lesson...

              Table Indexing appears to be the wrong way to solve my problem.

              What's the easiest way for filtering a table, so that i can access this table from several forms without filtering on each individual form? (that's what i mean with 'global filtering')

              Is that possible in principle?

              Thanks
              Michael

              Comment


                #8
                RE: '&lt;tbl&gt;.index_primary_put' not working

                Excellent advice - I missed noticing the the first 10 characters were not unique - but I cannot find anywhere the form method you mentioned [.Index_SetVerify().] where is it?
                Cole Custom Programming - Terrell, Texas
                972 524 8714
                [email protected]

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

                Comment


                  #9
                  RE: '&lt;tbl&gt;.index_primary_put' not working

                  if the table is always a parent or the only table the form is based on, you can create an index, and have the filter in the index, and set the form's main index to that respective index.
                  Cole Custom Programming - Terrell, Texas
                  972 524 8714
                  [email protected]

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

                  Comment

                  Working...
                  X