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

Fetch_Find with a compound index ???

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

    Fetch_Find with a compound index ???

    Greetings

    I have a table with an index defined as IDENT + SEQ
    Ident is Numeric (width=5) and Seq is Numeric (width=3).

    After I open my table and establish my Index with:
    tblHistory = table.open("History")
    tblHIStory.index_primary_put("IdentSeq")

    How do I set up a KEY for the fetch_find method ???
    Rec = tblHistory.fetch_find(Key)

    I know which Ident and which Seq I am looking for, but do not know how to get them into "Key" for the fetch to find the correct record.

    Key = Lookup_ident + Lookup_Seq ' does not work !!!

    Thanks in advance
    Bob

    #2
    RE: Fetch_Find with a compound index ???

    Probably should not be using numeric types in the key fields.

    The plus symbol is adding them together (12345 + 100 = 13345) instead of concatenating them, as would occur if you were using character type fields ("12345" + "100" = "12345100").

    See the difference?

    -- tom

    Comment


      #3
      RE: Fetch_Find with a compound index ???

      Thanks, Tom, for your answer and "yes" I see and understand the difference ..... BUT ....

      Now that I have the situation of the two numeric columns in my index, is there any way to set up the KEY value so that it DOES work.

      It will be a LOT of work to restructure the entire set of files if I have to change my main IDENT key to CHARACTER !!!!!

      Thanks, again
      Bob

      Comment


        #4
        RE: Fetch_Find with a compound index ???

        Read up on the STR() function.

        then go to the interactive editor,
        open an instance of the table,
        and play with different constructs:

        ?str(ident)
        ?ltrim(str(ident))
        ?str(seq)
        ?ltrim(str(seq))
        ?ltrim(str(ident))+ltrim(str(seq))
        ?str(ident)+str(seq)

        In picking the index key, Look for a concatenated string that will be easy to duplicate in your find keys.

        -- tom

        Comment


          #5
          RE: Fetch_Find with a compound index ???

          Robert:
          At first glance, I saw what Tom saw, that setting an index with 2 numeric fields will not work:
          IDENT =2 SEQ =2 will give you the same key for:
          IDENT =3 SEQ =1
          But all is not lost: set the index like this:
          str(ident)+str(seq), now you have unique keys.

          But that's not what you were asking: you were asking:
          How do I set up a KEY for the fetch_find method ???

          I am wondering, if the table is so big that you felt you would rather not change the numeric to character, how would you remember the key values for such records? Or are these values supplied by some other means?

          The reason I am sking is because, the script will depend on where are you getting these key values from?

          Gabe

          Comment


            #6
            RE: Fetch_Find with a compound index ???

            Hi Gabe

            THANKS for your reply.

            """Unfortunately""" I set the main index on my main "Members" table as Numeric in the first place, 2 years ago, and now, as my application grows, I am stuck with it. All my tables and sets link/index to this table with a numeric index on IDENT number.

            I have a form with fields that takes the operaror about 3-6 months to gather data and complete. When the operator has finally received all the information and this version of the form is completed, on the push of a button, I want to create a record in another file - my history file - and "dump" all this data into the history file and empty the form and the current table record. The cycle then begins all over again for this member. The operator collects the next set of data which will then, in 6 months or so, be added to the history and the form and and data record will be emptied and the next collection begins...

            Therefore, I am trying to add the next record to history for this member with a key of Ident + next sequential number for this ident.
            Ident 1 history rec 1
            Ident 1 history rec 2
            Ident 1 history rec 3 (strictly for next record sequencing)

            I could possibly use a date type field for sequencing, but that is the same problem of a compound index with Ident and Date and I am no further ahead ???

            Does this complicated explanation answer your question ???

            Thanks again
            Bob

            Comment


              #7
              RE: Fetch_Find with a compound index ???

              Robert:
              ""Does this complicated explanation answer your question ??? ""
              Actually the explanation is not complicatd, but the methodolgy seems to be.
              1-Evidentlly, you do not have a history file yet. How do you plan to do that?
              2-Why does the data have to be emptied to a history file?
              I suppose, you are going to say: because I need to empty the table to start a new cycle, so
              3-Why does the table have to be emptied before the next cycle?
              Gabe

              Comment


                #8
                RE: Fetch_Find with a compound index ???

                This is one I use to combine Char and Num in an index. Play with this to see if this will do what you want

                russ


                UT(GRADE)+" "+UT(TYPE)+" "+UT(FINISH)+" "+PADL(ALLTRIM(STR(SIZE_NUM_1,6,3)),5,"0")+" "+"X"+PADL(ALLTRIM(STR(SIZE_NUM_2,6,3)),5,"0")

                Comment


                  #9
                  RE: Fetch_Find with a compound index ???

                  This is another

                  PADL(STR(SIZE_NUM_1,7,3),7,"0")+" "+PADL(STR(SIZE_NUM_2,7,3),7,"0")

                  Russ

                  Comment


                    #10
                    RE: Fetch_Find with a compound index ???

                    on a button, you could say:

                    if you are looking for (indent=555) and (se=777)
                    since I don't know how you are getting the 555 and 777 from above, i won't deal with that here

                    parentform.index_set("indexname")
                    temp=alltrim(str(555)) + alltrim(str(777))
                    parentform.find(temp)

                    or

                    t=table.current() 'parent if in set
                    t.index_primary_put("indexname")
                    rec=t.fetch_find(temp)
                    if rec " 0
                    parentform.resynch()
                    else
                    ui_msg_box("","No records found")
                    end if
                    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


                      #11
                      Problem Solved - Thanks

                      Thanks for all your feed back - It steared me in the right direction for my solution.

                      I changed the history table key order parameter in the key definition for the table to be:
                      padl(alltrim(str(Ident)),5,"0") +
                      padl(alltrim(Str(Seq)),3,"0")

                      Now, I am no longer dealing with a key of two numeric fields, but a string key

                      Now I can set up my FIND key the same way and
                      I "AM" finding the records as I would expect to.

                      Thanks again
                      Bob

                      Comment

                      Working...
                      X