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 fails ?

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

    search fails ?

    When you index on both 'name'+'address' why does the
    search fail to work on the 'address' field ?
    Only works on the 'name' field.

    Harold

    #2
    RE: search fails ?

    Harold,

    You cannot search if the field on which you do the search is not indexed. What you are trying to do is like searching an address in a phone book.

    I suggest that you create a new index on the address or on address+name, if an address can refer to more than one name, and you should not have any problem.


    JP

    Comment


      #3
      RE: search fails ?

      For indexes based on character fields I believe the search works from left to right. Your search probably failed because Alpha Five did not find any 'names' that matched the 'address' you were searching on...


      For example, if the index is Name + Address, here's what the index might look like if you could see it:

      (These are all supposed to be fixed length, but I don't know how the message board will handle the blank spaces...)

      Albacore 202 Madison St.
      Jones 101 Smith St.
      Zulu 404 Apple St.


      If you try to search for '202 Madison St.' the 'find' will fail because '2' is not the leftmost value in any of the index entries.

      -- tom

      Comment


        #4
        RE: search fails ?

        Sorry guys I think you're not on the spot.
        The index is build on name+address and the search is performed -either - on the name or the address field. Only full,starting with the utmost left character, searches are being requested. Still fails. Also tried to invert the index.

        Harold

        Comment


          #5
          RE: search fails ?

          I think part of what Tom was pointing out, even with "full" searches, is that unless you know and use the full text length of the fields you will have problems.

          Searching for

          "Jones********220 Madison St********" (** for spaces)
          is not the same as
          "Jones220 Madison St"

          If your index is built on Name + Address, the first example is what the index tag is built like. Unless you construct a way to do some "right padding" of the search criteria, what is being searched for probably resembles the second example.

          You might try reconstructing your index and base it on rtrim(name)+rtrim(address).
          There can be only one.

          Comment


            #6
            RE: search fails ?

            Harold,

            This may be a little more cumbersome but it will give you the option to
            search on either field. Just create new indexes 1)Name 2)Address & use
            something similar to the code below & attach it to your search button.

            ''XBasic
            ON ERROR GOTO error_handler
            ui_freeze(.t.)
            search_type = ui_get_radio("Search For",1, "Name","Address")

            name_found = ui_get_text("Enter Search String", search_type)

            p=obj("formname")
            P.index_set(search_type)
            p.find(name_found)
            ui_freeze(.f.)
            error_handler:
            err = error_code_get()
            msg = error_text_get(err)
            ui_msg_box("Error", msg)
            ui_freeze(.f.)
            END

            Comment


              #7
              RE: search fails ?

              I say again.

              If your index is defined as name + address, you can never find a record by searching (finding) only for an address. The index key used to 'find' records consists of a name plus the blank spaces which follow it *and* the address plus the blank spaces which follow it.

              'Find by key' is not a 'locate' type function which scans specified fields and returns any matching values found any where within it.

              If this, too, is not on the spot, how about telling us how you are doing your 'search'? (All the tedious details will help.)

              -- tom

              Comment


                #8
                RE: search fails ?

                Ok, thanks this looks more to the point. I'll try it out later tonight.

                Harold

                PS: is ther no way to get the messages "centered" on the
                message board screen ?

                Comment


                  #9
                  RE: search fails ?

                  this script uses two indexes lastname & address when you press the button with this script it will ask you for a last name or address when you enter a one word last name or two or more word address it will select the index and find the closest match.(the number part of the address counts as a word)


                  dim findwhat as c
                  findwhat = ui_get_text("Find","Enter Last name or Address","smith","")
                  'for this to work address must be two words or more
                  'and last name must be one word
                  select
                  case findwhat = ""
                  'nothing to find

                  case val(findwhat) = 0 .and. w_count(findwhat) 1
                  'more than 1 word
                  parentform.index_set("address")
                  parent.find(findwhat.value)

                  end select

                  topparent.resynch()

                  Comment


                    #10
                    RE: search fails ?

                    Another way is to search using the Find by Form. Although it has a slight flaw, it is a great search tool. After selecting the FBF icon, click in either the name or address field. If the name field, type even part of the name, the more letters you type, the closer the match. No need to use the * as a wild card. You can then move to the address field and type part of the address or all of it. Press F-9 or click the lightening bolt.

                    FBF will find the closest or exact match to the criteria you entered. Depends on how much criteria you entered.

                    The great thing about FBF is that you can search any field or combination of fields. It's supposed to act like a query but not filter out the remaining records.

                    Now the flaw. When exiting the form, A5 uses FBF like a query and the record/s which were found are the only record/s showing. Hence, when you re-enter the form, you must click the "show all" icon.

                    I have a button that pops up a browse, I can enter a letter or letters and the closest match is found. For instance, when I type C all the names that beging with C come into view. As I add letters, the browse moves to the closest match. When I find what I want, I press the enter key and the record appears on my form which matches the record I chose on the popup browse. And, it's not seceptible to the FBF flaw.

                    Hope this is of some help.

                    kenn
                    TYVM :) kenn

                    Knowing what you can achieve will not become reality until you imagine and explore.

                    Comment


                      #11
                      RE: search fails ?

                      Ok,
                      I tried this one but when runing it returns an "argument incorrect
                      data type" error.
                      ON ERROR GOTO error_handler
                      ui_freeze(.t.)
                      search_type = ui_get_radio("Search For",1, "Name","Address")

                      name_found = ui_get_text("Enter Search String", search_type)

                      p=obj("formname")
                      P.index_set(search_type)
                      p.find(name_found)
                      ui_freeze(.f.)
                      error_handler:
                      err = error_code_get()
                      msg = error_text_get(err)
                      ui_msg_box("Error", msg)
                      ui_freeze(.f.)
                      END

                      Comment


                        #12
                        RE: search fails ?

                        Did you create the indexes as specified in the post?
                        There can be only one.

                        Comment


                          #13
                          RE: search fails ?

                          Hi Harold,

                          I did not try the script before I posted it, but decided to check it out
                          to make sure that it worked. It worked fine for me, it reports error
                          message 0 via this line "ui_msg_box("Error", msg) " which means that there
                          was no error. So if you don't want to know if there wasn't an error you can
                          modify the script as follows.

                          I am not sure why you got the "argument incorrect data type",if you built the
                          2 new indexes "name" & "address" and used the name of your form for the line
                          p=obj("formname") it should have worked. I agree with Tom & the others, I don't
                          see a way to use the index name+address to search for either the name or address,
                          although it wouldn't supprize me if someone out there with a little more
                          experience could come up with something.



                          ON ERROR GOTO error_handler
                          ui_freeze(.t.)
                          search_type = ui_get_radio("Search For",1, "Name","Address")

                          name_found = ui_get_text("Enter Search String", search_type)

                          p=obj("formname")
                          P.index_set(search_type)
                          p.find(name_found)
                          ui_freeze(.f.)
                          error_handler:
                          err = error_code_get()
                          if err=0 THEN 'don't want to know that there was no error
                          goto bottom
                          end if
                          msg = error_text_get(err)
                          ui_msg_box("Error", msg)
                          bottom:
                          ui_freeze(.f.)
                          END

                          Comment


                            #14
                            RE: search fails ?

                            I have an index that is used to find inventory items that may be identified by some of several possible fields. To deal with the spacing problem that is discussed above the index expression is as follows:

                            index = ltrim(alltrim(field_1) + " " + alltrim(field_2) + " " + alltrim(field_3) + " " + alltrim(field_4))

                            This would allow you to search on address only if there were no name present in the record, and you could enter a name and address with just one space (regardless of the name's length), but I agree that it would not allow for either/or when both are present.

                            -Bill

                            Comment


                              #15
                              RE: search fails ? not anymore !

                              First of all thanks to all of you for the help.
                              The correct answer was already available, thanks to Dr Wayne !
                              here it is: ( slightly modified to fit my needs, but only on
                              minor details )
                              It works flawlessly, as requested.
                              ========================================================
                              DIM GLOBAL global_search_text as c
                              DIM GLOBAL global_search_field as c

                              '---------------------------------------------------------------------------------
                              ' MAKE SURE THE USER ISN'T STILL ENTERING/MODIFYING THE CURRENT RECORD.
                              '---------------------------------------------------------------------------------
                              stbl=table.current()
                              IF stbl.mode_get() > 0
                              ui_msg_box( "ERROR", "In data entry mode. Please save record before running
                              the LOCATE operation.", 48)
                              END
                              END IF

                              '---------------------------------------------------------------------------------
                              ' IF DESIRED, THIS SECTION CAN BE USED TO INFORM THE USER HOW THE BUTTON
                              'WORKS.
                              '---------------------------------------------------------------------------------
                              'response=ui_msg_box( "INFORMATION",
                              '"This command will find the FIRST occurrence of the text you enter." +chr(013)+
                              '"- To find additional occurrences, simply press the ENTER key twice." +chr(013)+
                              '"- Repeat this sequence until you see the message box 'No more occurrences found'.",
                              'UI_INFORMATION_SYMBOL+UI_OK_CANCEL )
                              'IF response=ui_cancel_selected
                              ' END
                              'END IF

                              '---------------------------------------------------------------------------------
                              ' IF NO global_search_text EXISTS, THIS ROUTINE HAS NOT BEEN RUN BEFORE IN
                              ' THIS SESSION SO IT MUST BE A NEW SEARCH.
                              ' OTHERWISE, FIND OUT WHETHER TO REPEAT THE PREVIOUS SEARCH OR START A
                              'NEW ONE.
                              '---------------------------------------------------------------------------------
                              IF global_search_text=""
                              search_type="New"
                              ELSE
                              search_type=ui_get_list( "SEARCH TYPE", 1, "Locate Next '" + global_search_text + "'", "New" )
                              IF search_type=""
                              END
                              END IF
                              END IF

                              '---------------------------------------------------------------------------------
                              ' IF IT IS A NEW SEARCH, FIND OUT WHAT TEXT TO SEARCH FOR AND WHICH FIELD(S)
                              ' TO SEARCH. THEN, SEARCH THE FIRST RECORD.
                              ' *NOTE*: GOING TO THE FIRST RECORD AND DOING A .fetch_loc_next WILL NOT
                              ' SEARCH THE FIRST RECORD.
                              '---------------------------------------------------------------------------------
                              IF search_type="New"
                              global_search_text=ui_get_text( "TEXT TO FIND", "Enter text to Find - caps not
                              important.", global_search_text )
                              IF global_search_text=""
                              END
                              END IF
                              global_search_field=ui_get_list( "FIND IN:", 1, "NAAM", "STAD",
                              "All - STRAAT, BUITENLAND, TAAL" )
                              IF global_search_field=""
                              END
                              ELSE
                              IF global_search_field="All - STRAAT, BUITENLAND, TAAL"
                              global_search_field=""
                              END IF
                              '---------------------------------------------------------------------------
                              ' THIS AREA CAN BE MODIFIED TO ALLOW YOU TO ASK FOR A GENERIC
                              ' FIELD NAME THAT THE USER UNDERSTANDS AND THEN CONVERT TO
                              ' THE REAL FIELD NAME.
                              ' ex: IF global_search_field="Status"
                              ' global_search_field="Stat_1"
                              ' END IF
                              ' THIS COULD EVEN BE EXPANDED TO WORK WITH MULTIPLE FORMS BY
                              ' CHECKING THE FORM NAME. CONTACT [email protected] FOR MORE INFO.
                              '---------------------------------------------------------------------------
                              END IF
                              '------------------------------------------------------------------------------
                              ' CHECK THE FIRST RECORD BY GOING TO THE SECOND RECORD THEN SEARCHING
                              'BACKWARD.
                              '------------------------------------------------------------------------------
                              stbl.fetch_first()
                              stbl.fetch_next()
                              found=stbl.fetch_loc_prev( global_search_text, global_search_field )
                              IF found
                              parentform.resynch()
                              END
                              ELSE
                              '---------------------------------------------------------------------------
                              ' IF "fetch_loc_prev" DOESN'T FIND IT, THE POINTER STAYS IN THE SECOND
                              ' RECORD. THIS LINE TAKES YOU BACK TO THE FIRST RECORD SO THE SEARCH CAN
                              ' CONTINUE LATER.
                              '---------------------------------------------------------------------------
                              stbl.fetch_first()
                              END IF

                              ELSE '--- search_type *NOT* "New"
                              current_rec=table.current().recno()
                              '------------------------------------------------------------------------------
                              ' FIND NEXT *PARENT* RECORD (next RECORD could be just a new child record.)
                              ' USING A "1" IN THE .fetch_next() FETCHES ONLY THE PARENT TABLE.
                              '------------------------------------------------------------------------------
                              table.current().fetch_next(1)
                              '------------------------------------------------------------------------------
                              ' IF THE 'NEXT' PARENT RECORD IS THE SAME AS THE CURRENT RECORD, THEN WE
                              'WERE
                              ' ALREADY IN THE LAST RECORD. OBVIOUSLY NOTHING ELSE TO SEARCH.
                              ' OTHERWISE, BACK UP ONE RECORD TO THE LAST CHILD RECORD OF THE 'CURRENT'
                              ' RECORD. BY STARTING THE NEXT SEARCH AT THE LAST CHILD RECORD OF THE
                              'CURRENT
                              ' PARENT RECORD, WE WILL NOT BE CHECKING THE CURRENT RECORD AGAIN.
                              '------------------------------------------------------------------------------
                              next_rec=table.current().recno()
                              IF current_rec=next_rec
                              ui_msg_box( "DONE", "No more occurrences found.")
                              END
                              ELSE
                              table.current().fetch_prev()
                              END IF

                              END IF

                              '---------------------------------------------------------------------------------
                              ' THIS IS THE NORMAL 'LOCATE' ROUTINE USED TO SEARCH EVERYTHING BUT THE
                              ' FIRST
                              ' RECORD. ALSO, IT IS NOT USED IF THE TEXT WAS ALREADY FOUND IN THE *LAST*
                              'RECORD.
                              '---------------------------------------------------------------------------------
                              found=stbl.fetch_loc_next( global_search_text, global_search_field )

                              '---------------------------------------------------------------------------------
                              ' WARN THE USER IF NOTHING WAS FOUND.
                              '---------------------------------------------------------------------------------
                              IF .not.found
                              ui_msg_box( "DONE", "No more occurrences found.")
                              ELSE
                              parentform.resynch()
                              END IF

                              END
                              ========================================================

                              Comment

                              Working...
                              X