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

Can't figure it

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

    Can't figure it

    I created a small script to search for a keyword. I have one machine running A5v4 and one on A5V3 worked fine on both.
    Had a crash and had to reinstall A5V4 on one and now it doesn't work on the A5V4 but does on A5V3
    Tell me if you see something

    ''XBasic
    dim jn as p
    dim tsearch as c
    tsearch=ui_get_text("Job Text Search Box","Enter the Search String")
    if tsearch=""
    end
    end if
    jn=table.open("job numbers",FILE_RW_SHARED)
    update.fields = 1
    update.field1 = "search"
    update.expr1 = ".f."
    jn.update()
    jn.fetch_first()
    while .not. jn.fetch_eof()
    if like(tsearch,jn.job_name)
    jn.change_begin()
    jn.search=.t.
    jn.change_end()
    end if
    jn.fetch_next()
    end while

    query.description = ""
    query.order = ""
    query.filter = "SEARCH=.T."
    query.options = "I"
    jn.query_create()
    browse.view("jsb")

    #2
    RE: Can't figure it

    Your script looks fine.

    Possible that you made other 'minor' changes? Like() is case sensitive, maybe you transformed job_name to uppercase?
    There can be only one.

    Comment


      #3
      RE: Can't figure it

      The script listed was the cut and paste from the db.

      I'M getting pretty grumpy.

      Comment


        #4
        RE: Can't figure it

        I meant maybe you've changed the values in the job_name field to be transformed to uppercase, or proper first caps. Then if the tsearch variable was lower case, the search would fail.

        Do you have two versions of your tables, one for V4 and one for V3, or one set of tables and an app in each version looking at the same tables?
        There can be only one.

        Comment


          #5
          RE: Can't figure it

          Both are looking at the same tables.

          A two computer network.

          When I do the search it finds every record.

          Comment


            #6
            RE: Can't figure it

            I don't have much knowledge of previous versions.

            Two things:

            query.options = "I"

            I don't remember this and can't find it in the docs or readme file, options I see are M, N, X, D, U.

            jn.query_create()

            Examples all show as

            indx = jn.query_create()

            Wild guessing here, probably not much help. Finding all records sounds like nothing is happening with the query.
            There can be only one.

            Comment


              #7
              RE: Can't figure it

              Stan,

              query.options = "I"

              means case insensitive.

              It's buried in some readme or someplace. I didn't know what if meant for the longest time.

              Bill
              Bill Hanigsberg

              Comment


                #8
                RE: Can't figure it

                OK, I learned something today ("I"). What about M & X?
                Peter
                AlphaBase Solutions, LLC

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


                Comment


                  #9
                  RE: Can't figure it

                  Bruce, I wasn't familiar with the tbl.update() method you use, so I read the manual. In vers. 4 this method requires exclusive use of the table according to the book. Don't know what vers. 3 needed, or whether this makes a difference.

                  If the same script ran fine under vers. 4 before your crash I'd begin thinking of a thorough scan disk, and possibly reinstalling vers. 4...

                  Hope these ideas help.

                  -- tom

                  Comment


                    #10
                    RE: Can't figure it

                    Peter,

                    From the 403 readme

                    New Options for .Query_Create Method
                    Alpha Five now has two new option flags for the .query_create() method. These options are set with
                    the query.options variable. The options are:
                    query.options = "M"
                    If this option is specified, Alpha Five will build a new query list even though a) an existing query list exists,
                    and b) an existing Index exists (both of which, Alpha Five could have used rather than running a new
                    query).
                    query.options = "X"
                    If this option is specified, Alpha Five will use an index even if an existing query exists (which Alpha Five
                    would otherwise have used in preference to the index)
                    If no options are specified, then when you run a query, Alpha Five does the following:
                    a) if the same query has been previously run, use that query list.
                    b) if not, but if an index that satisfies the query criteria exists, use the index.
                    c) if a previously run query does not exist, and if no index exists, run a new query.
                    Previously, Alpha Five only offered one option, �N�, which caused Alpha Five to run a query, rather than
                    selecting an index, if an index would have satisfied the query criteria.
                    If you want to trade off speed for certainty that your applications will run correctly, you should consider
                    using the �M� option in your Xbasic code. (In most applications the speed difference will probably not even
                    be noticeable.) This ensures that whenever you use the query_create() method, Alpha Five is creating a new
                    query from scratch, and not relying on a previously run query, or an index, that could be corrupt.
                    For example:
                    Tbl = table.open(�customer�)
                    Query.filter = �state = �ma��
                    Query.order = �lastname�
                    Query.options = �M�
                    Indx = tbl.query_create()


                    And thanks yet again to Bill.

                    Stan
                    There can be only one.

                    Comment


                      #11
                      RE: Can't figure it

                      Bruce,
                      Looking at your script, I see a number of possible problems. When I tried it with a test table, it found no records and both the update and query failed. The first problem is that you are fetching thru the table twice, first with the update and then the fetch itself. This could slow the search greatly on large tables. The second is that you do not specify and index at the start of the script and therefore whatever index or query is in effect when the script runs will determine what records are searched. If a query exists at the start, only the records in that query will be updated and fetched. The third problem is with the variable used in the LIKE expression. Like is case sensitive, so it would be a good idea to change both the field value and the variable to trimmed, lower or upper case.

                      In any case, here is a modified script that I tested with a test table with dummy data and it worked even if I specified a wildcard in the search criteria.

                      dim jn as p
                      dim tsearch as c
                      tsearch=alltrim(lower(ui_get_text("Job Text Search Box","Enter the Search String")))
                      if tsearch=""
                      end
                      end if

                      jn=table.open("job numbers",FILE_RW_SHARED)
                      idx = jn.index_primary_put()'/// Sets index to recno order

                      count = 0
                      jn.fetch_first()
                      while .not. jn.fetch_eof()
                      jn.change_begin()
                      if like(tsearch,alltrim(lower(jn.job_name) ))
                      jn.search=.t.
                      count = count + 1
                      else
                      jn.search=.f.
                      end if
                      jn.change_end()
                      jn.fetch_next()
                      end while

                      if count = 0
                      jn.close()
                      ui_msg_box("Search","No records found that meet search criteria",UI_ATTENTION_SYMBOL)
                      end
                      end if
                      query.description = ""
                      query.order = ""
                      query.filter = "SEARCH=.T."
                      jn.query_create()
                      browse.view("jsb")

                      end

                      I found the if statement to kick out of the script if no records were found to be necessary. If no records were found, the browse would open in enter mode.

                      Jerry

                      Comment


                        #12
                        RE: Can't figure it

                        Jerry,
                        I tried the script as you had it.

                        If I use straight text it will never find a record.

                        If I add a wildcard in any position of the search it pulls every record.

                        I ran the script as it was before, and then ran a query to search for records with a .T. in the search field. It pulled up exactlly the correct fields. Therefore the search is correct but the query list is the root of the problem.
                        Any suggestions?

                        Bruce

                        Comment


                          #13
                          RE: Can't figure it

                          Where has all this query information come from. I have spent the last few weeks trying to force new queries with the 'N' option with no success. Where is the info describing the further options.

                          The documentation that I have read only gives three options but it does say that a query can have one or more options. How does one force more than one option? Would it be

                          query.options="N,D" or

                          query.options="ND" without a comma

                          Any help appreciated

                          Michael

                          Comment


                            #14
                            RE: Can't figure it

                            From the 403 readme

                            New Options for .Query_Create Method
                            Alpha Five now has two new option flags for the .query_create() method. These options are set with
                            the query.options variable. The options are:
                            query.options = "M"
                            If this option is specified, Alpha Five will build a new query list even though a) an existing query list exists,
                            and b) an existing Index exists (both of which, Alpha Five could have used rather than running a new
                            query).
                            query.options = "X"
                            If this option is specified, Alpha Five will use an index even if an existing query exists (which Alpha Five
                            would otherwise have used in preference to the index)
                            If no options are specified, then when you run a query, Alpha Five does the following:
                            a) if the same query has been previously run, use that query list.
                            b) if not, but if an index that satisfies the query criteria exists, use the index.
                            c) if a previously run query does not exist, and if no index exists, run a new query.
                            Previously, Alpha Five only offered one option, �N�, which caused Alpha Five to run a query, rather than
                            selecting an index, if an index would have satisfied the query criteria.
                            If you want to trade off speed for certainty that your applications will run correctly, you should consider
                            using the �M� option in your Xbasic code. (In most applications the speed difference will probably not even
                            be noticeable.) This ensures that whenever you use the query_create() method, Alpha Five is creating a new
                            query from scratch, and not relying on a previously run query, or an index, that could be corrupt.
                            For example:
                            Tbl = table.open(�customer�)
                            Query.filter = �state = �ma��
                            Query.order = �lastname�
                            Query.options = �M�
                            Indx = tbl.query_create()

                            There can be only one.

                            Comment


                              #15
                              RE: Can't figure it

                              Thanks Stan
                              Peter
                              AlphaBase Solutions, LLC

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


                              Comment

                              Working...
                              X