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

search a non-unique key

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

    search a non-unique key

    Here's one for you! I have a database which has as it's index the date and time of the inputted item - call them InputDate and InputTime. I want to have a search button which will take the user to the start of the InputDate, so that they could scroll down through the records and find the record they want. Because the key is non-unique, I can't get it to work. Any thoughts?

    #2
    RE: search a non-unique key

    Charles,

    First thought here would be to leave the index set as you describe, but fetch_find() only the date. Should take you to the first entry for the date, and all other entries would remain in time order...

    -- tom

    Comment


      #3
      RE: search a non-unique key

      XBasic is NEVER simple! Oh for the good old days of dBaseIII! Oh well, Here's the code I've got...

      tbl = table.current()
      tbl.index_set("sdate2")

      searchdate = ui_get_date("seardate","What date to you want to search FROM?",dtoc(date()))
      if searchdate "" then
      seardate = ctod("searchdate")
      end if

      tbl.fetch.find(seardate)

      Comment


        #4
        RE: search a non-unique key

        Tom,

        I made a few changes and here's what works...

        tbl = table.current()

        searchdate = ui_get_date("seardate","What date to you want to search FROM?",dtoc(date()))
        if searchdate "" then
        seardate = ctod(searchdate)
        end if

        tbl.fetch_find(seardate)

        The trick is theat the index needs to be of the same data type expression or it won't work. I found this out by performing the steps interactively. That sure helps a lot to test things out. Then you can go through things step by step.

        I'm far from done with this latest job, so I may yet still need you invaluable help!!! Thanks.

        Comment


          #5
          RE: search a non-unique key

          Tom,

          I'm hung up again. It was working! I swear!

          Here's my code...

          dim seardate as d
          dim searchdate as c
          dim orderdate as d

          tbl = table.current()

          tbl.index_primary_put("orderdate")

          tbl.fetch_first()
          searchdate = ui_get_date("seardate","What date to you want to search FROM?",dtoc(date()))
          if searchdate "" then
          seardate = ctod(searchdate)
          end if

          tbl.fetch_find(seardate)

          The orderdate index is simply sdate (the input date). I keep getting errors saying I have the wrong expression types, but try as I might, I can't get them to go away.

          Any thoughts?

          Comment


            #6
            RE: search a non-unique key

            Tom,

            Here's another way I'm fond of. I put a radio button on a form so the user can select the method of searching. The then fill in a variable box to the right called search_for. Here they would enter the date they wanted to start their search at. I then put a Find button next to that with this code (in part)...

            CASE Search_by.value = "IDate"
            topparent.index_set("sdate")
            dim seardate as d
            dim searchdate as c

            ''seardate = ctod(search_for.value)
            topparent.find(search_for.value)

            I left out the rest of the case statement, but you get the idea. Trouble is, it won't look up. No errors, but it won't go to the record. Any ideas?

            Comment


              #7
              RE: search a non-unique key

              Looking at your original effort, you say that the index is based on date and time. If you let Alpha create the index (call it test) and the date and time fields are date and character respectively, A5 will define the index as
              cdate(datefield)+timefield

              For your find to work, your find string must match the first part of the index. CDATE returns 20020505 whereas CTOD and DTOC return 05/25/2002 and won't match.

              Finally, assuming that you are running this from a button on a form, you must resynch your form to show the change.

              This works:

              '===
              tbl = table.current()
              tbl.index_primary_put("Test")
              searchdate = ui_get_date("seardate","What date to you want to search FROM?",dtoc(date()))
              if searchdate "" then
              seardate = cdate(ctod(searchdate))
              end if
              tbl.fetch_find(seardate)
              parentform.resynch()
              '===

              Finian
              Finian

              Comment


                #8
                RE: search a non-unique key

                Thanks. I like this a lot. You're right. I did fall into that date trap late last night and was thinking of old dBase coding.

                I'll try out what you have here. I really appreciate your kind help!

                Comment

                Working...
                X