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?

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

    Search?

    The following script work fine with an index:
    topparent.find(search.value)

    However, it does not seem to work with a filtered query. Here is the query:
    query.description = "G_Est_No"
    query.order = "NEW_BUS->Year + NEW_BUS->EST_NO"
    query.filter = "substr(NEW_BUS->EST_NO,8,1)'H'"
    query.options = ""
    tbl.query_create()


    Any suggestions?
    Peter
    Peter
    AlphaBase Solutions, LLC

    [email protected]
    https://www.alphabasesolutions.com



    #2
    RE: Search?

    I tried the same thing, substituting values and field names to suit one of my tables. It worked fine. When you say it doesn't work, exactly what happens?

    One thought: your last line is

    tbl.query_create()

    Did you define what tbl is? (i.e., tbl=table.open("table_name") or tbl=table.current() )

    Does the query work as expected? If so, what happens when you run the find?

    Comment


      #3
      RE: Search?

      Bill,
      Thanks. The query works fine as do a dozen other queries used in that set. What happens is the query runs and that's it - no find. But, I just checked the book, it says the .find() command is supposed to work w. indexes, so I suppose that excludes queries. So I guess I am surprised that it works for you.
      Peter
      Peter
      AlphaBase Solutions, LLC

      [email protected]
      https://www.alphabasesolutions.com


      Comment


        #4
        RE: Search?

        Peter,

        Most people have trouble framing the filter expression when building a query in xbasic. It's likely that Bill just checked the syntax of the query filter expression, using one of his own tables. He confirmed that it works.

        There's a big difference between a find by key and a query. The find by key is designed to search for the first matching record, only. The query is designed to return a collection of all matching records.

        Can you explain further what it is you are trying to accomplish?

        -- tom

        Comment


          #5
          RE: Search?

          Hi Peter
          I wonder if a range filter would not better suit your needs. My case: Sales department quote log. All quotes are in one .dbf for all the sales reps. Each rep has their own form specifically for quotes they have written. But, they also need to be use the "find by key" with set indexes, such as by customer or quote number, etc.

          Example:
          Rodger needs to find a quote #, but it only needs to look at quotes Rodger has written. I have a button on the form to change the index, such as "Search by Quote #".

          tbl.index_primary_put("Quote_Number")
          range.flags=range_filter
          range.filter="sales_rep='Veneman, Rodger'"
          tbl.range_add()
          parent.resynch()

          Then he can use the "find" icon on the tool bar.

          Just a thought.
          Mick

          Comment


            #6
            RE: Search?

            Peter, I made some assumptions when you sent your script, and then tested mine. Let's see if I can be a little clearer.

            I ran the query. Then I ran the find. The query gave me the correct records, and then the find returned the first record with the value I entered.

            Your find script will return a record. Your query should return one or a group of records, depending on the search criteria.

            If you put the find script AFTER the query, maybe that will give you what you want. Or, you could run the query with a sort but NO filter, and use the find to return the first record, based on that sort.

            Did that help??

            Comment


              #7
              RE: Search?

              Tom,
              The query works as advertised. I'm running the query and trying to find a record based upon the querie's order.
              Peter
              Peter
              AlphaBase Solutions, LLC

              [email protected]
              https://www.alphabasesolutions.com


              Comment


                #8
                RE: Search?

                Mick,
                Thanks. I have avoided ranges since DOS. I'm trying to simplify my life:-)
                Let me see what else works first.
                Peter
                Peter
                AlphaBase Solutions, LLC

                [email protected]
                https://www.alphabasesolutions.com


                Comment


                  #9
                  RE: Search?

                  Bill,
                  I ran the query. Then I ran the find. The query gave me the correct records, and then the find returned the first record with the value I entered.

                  I ran the query. Then I ran the find. The query gave me the correct records. The find "returns" the first record in the query, not the value I want.

                  Your find script will return a record. Your query should return one or a group of records, depending on the search criteria.

                  The query works, the find does not.

                  If you put the find script AFTER the query, maybe that will give you what you want.

                  I put the find after the query. No dice.

                  Or, you could run the query with a sort but NO filter, and use the find to return the first record, based on that sort.

                  I need the filter.

                  Thanks,
                  Peter
                  Peter
                  AlphaBase Solutions, LLC

                  [email protected]
                  https://www.alphabasesolutions.com


                  Comment


                    #10
                    RE: Search?

                    Hi Peter
                    I'm bored and have no life so I made a simple file to test.

                    Field 1 is color, Field 2 is a name. A button on the form creates a query filtering out any color with an R in the 3rd position (purple). The query runs and a msg_box pops asking for the find criteria.

                    Since my query order is alltrim(f1)+alltrim(F2), the topparent.find will look in the field 1 (color). If the data is BLACK (f1) and the name is RICK (f2), the topparent find will see "BLACKRICK", and return the closest thing based on what I entered in the dialog box. Is this what your trying to do?

                    Mick

                    Comment


                      #11
                      RE: Search?

                      Hi Mick,
                      I am tired now and will look at your download tomorrow. Take heart in that humility is a great virtue! Thanks for your effort.
                      Peter
                      Peter
                      AlphaBase Solutions, LLC

                      [email protected]
                      https://www.alphabasesolutions.com


                      Comment


                        #12
                        RE: Search?

                        Bill,

                        I think the problem Peter is having is this. When you run the query the query list becomes active. He then wants to do a find (which is essentially a find by key). The find requires a primary index.

                        Haven't bumped into this before because, since the find is so fast, I don't bother to create the query first. Perhaps Peter needs it for other purposes.

                        Apart from Mick's idea using a filtered range, maybe Peter could open a second instance of the table, set the desired index primary, and do his find there. But if he needs to know whether that particular record falls within his 'range' (identified in the query list) this wouldn't help.

                        -- tom

                        Comment


                          #13
                          RE: Search?

                          I think the problem Peter is having is this. When you run the query the query list becomes active. He then wants to do a find (which is essentially a find by key). The find requires a primary index.

                          Exactly

                          Haven't bumped into this before because, since the find is so fast, I don't bother to create the query first.

                          Tom, what do you mean. Can you expand on that?

                          Perhaps Peter needs it for other purposes.

                          Yes, the query segregates records by company division. The division manager or employee needs to find the record for that division w/o seeing the other division's records.
                          Peter
                          AlphaBase Solutions, LLC

                          [email protected]
                          https://www.alphabasesolutions.com


                          Comment


                            #14
                            RE: Search?

                            Peter,

                            The find by key uses the primary index and is virtually instantaneous. Unlike a query the sorted list does not need to be specially prepared before doing the find. You just set the desired index primary, and do the find. bingo you have the result.

                            It sounds like you are trying to prevent one user from seeing another's records. this may be a good reason to build a list of qualifying records, and then do the find from among those only. Mick's filtered range will do this.

                            Another alternative would be to prequalify the find key. Instead of using whatever key might be supplied by the user, collect the input, and then validate it yourself. If the user is looking for something that belongs to another user, don't do the find at all. Otherwise set the index primary, and do the find instantly. You would have to be careful to prevent further navigation by the user, once the found record appears, but that might not be too hard.

                            -- tom

                            Comment


                              #15
                              RE: Search?

                              If you are trying to limit the records displayed to those entered by a particular user, and the current user code is kept in a global variable, you could put a form filter in the properties of the form sorted by the field or expression that you want to find by. When the user enters the form, nothing will have to be done but execute the find.

                              Comment

                              Working...
                              X