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

Enter must begin first

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

    Enter must begin first

    Hello all,

    I have been having trouble with my search form off and on. It will work for a while, and then the next time I try it, it fails, telling me that "Enter must begin first". Each time it fails, I tinker around with the code, trying a slightly different method of achieving the same goal. Eventually it will start working again, but not forever! I'm not too proud of this block of code; it is quite messy since I keep trying new things. Also, one of my biggest successes seems to come from doing something which is not the "standard" way. I have pasted a section of my code here for you guys to look at, but I will now try to explain some of it to you.

    This section of code is part of an OnClick event of a button. Earlier in the script, I queried an external SQL database for some information. Now I want to store that information in the table on which this form is built. It seems to me that the best way of accomplishing this is to zap the table (empty it) and enter in the new data. At the end of this code, I show a browse (called SearchResults) which is linked to the Search table. The problems I am having seem to revolve around entering in the data.

    I have tried using Table.Open, Table.Get, and Table.Current. I have tried using Enter and Change.

    I am sure that much of my code is quite useless and redundant; I was just trying to throw in every check and safety I could think of.

    The most interesting lines of code (in my opinion) are Blank.Activate() and ShipmentNumber.Activate(). I am basically using inherent code built into the form in order to achieve my goals. The Blank field is tied to a field in the Search table, so entering that field (I think) puts the table into enter mode. The ShipmentNumber field is tied to a variable, not the Search table, so entering it from the Blank field (I think) saves the record that was being entered, and takes the table out of enter mode. Another possibility is that because we cycled through every field on the form (Think of Monopoly - Advance to a space half way across the board, then advance to your original space; you went one full circle), it saved the current row and moved on to the next row of the table. I don't really know what is happening when I do this or why it works, but it magically helps me fulfill my goals.

    Here is my code as I currently have it. Commented code is present to show things I've tried, and to easily switch between different ideas:
    Code:
    RS = LabelDatabase.ResultSet
    dim SearchTable as P
    'SearchTable = Table.Current()
    SearchTable = Table.Get("Search")
    if SearchTable.Mode_Get() = 1 then
    	SearchTable.Change_End(.t.)
    	xbasic_wait_for_idle()
    elseif SearchTable.Mode_Get() = 2 then
    	SearchTable.Enter_End(.t.)
    	xbasic_wait_for_idle()
    end if
    SearchTable.Zap(.t.)
    'SearchTable.Fetch_First()
    'dim CurrentRecord as N
    while RS.NextRow()
    '	CurrentRecord = SearchTable.RecNo()
    	if SearchTable.Mode_Get() = 0 then
    		SearchTable.Fetch_Last()
    		SearchTable.Enter_Begin(.t.)
    	elseif SearchTable.Mode_Get() = 1 then
    		SearchTable.Change_End(.t.)
    		xbasic_wait_for_idle()
    		SearchTable.Enter_Begin(.t.)
    		xbasic_wait_for_idle()
    	end if
    '	SearchTable.Enter_Begin(.t.)
    '	SearchTable.Change_Begin(.t.)
    	Blank.Activate()
    		SearchTable.ShipmentNumber = RS.Data("ShipmentNumber")
    		SearchTable.SalesOrderNumber = RS.Data("SalesOrderNumber")
    		SearchTable.JobNumber = RS.Data("JobNumber")
    		SearchTable.UserID = RS.Data("UserID")
    		SearchTable.DateModified = RS.Data("Date")
    	ShipmentNumber.Activate()
    '	SearchTable.Enter_End(.t., .t.)
    '	SearchTable.Change_End(.t., .t.)
    	if SearchTable.Mode_Get() = 1 then
    		SearchTable.Change_End(.t.)
    		xbasic_wait_for_idle()
    	elseif SearchTable.Mode_Get() = 2 then
    		SearchTable.Enter_End(.t.)
    		xbasic_wait_for_idle()
    	end if
    '	SearchTable.Fetch_GoTo(CurrentRecord)
    '	SearchTable.Fetch_Next()
    end while
    SearchResults.Show()
    If anyone can help me find a better way to accomplish my task, I would really appreciate it!

    Jacob Hapner
    IT Intern
    Hyndman Industrial Products, Inc.

    #2
    Re: Enter must begin first

    Jacob,

    <object>.mode_get() checks the mode of a LAYOUT, not of a table. You are using it to check the mode of the table. The normal use is parent.mode_get() or similar - I believe this is what causes your error.

    *** Sorry, I was wrong - apparently there is a table.mode_get() as well - please disregard my post.

    Having said that, I noticed that you check the mode of the table after zapping it. I don't believe a zap operation should leave your table in change or enter mode.

    The other thing I would check is to make sure you don't also have a form or browse also called searchTable.
    Last edited by mariusm; 07-01-2011, 10:43 AM.
    It is easier to get older than wiser

    Comment


      #3
      Re: Enter must begin first

      Thank you for your reply.

      Yes, I am doing more checks than I should need. I don't think that will hurt anything, though. The check that happens after I zap the table is inside the while loop, so it will execute at other times as well, which may be needed. Thank you for confirming that the zap operation will not leave the table in change or enter mode.

      I do not have a form or browse called SearchTable. The table is called "search", the form is called "Search", and the browse is called "SearchResults". The first instance of "SearchTable" occurs when I create the table pointer, as shown in the second line of my code.

      Once again, thanks for your attempts to help. Would anyone else like to take a shot at this now?
      Jacob Hapner

      Comment


        #4
        Re: Enter must begin first

        Jacob, I sent you a private message, but haven't rec'd a reply. Did you miss it?

        Comment


          #5
          Re: Enter must begin first

          Apparently I don't have permission to send or receive private messages yet. I had to contact tech support just to get permission to post, so I'll contact them again for this now...

          Comment


            #6
            Re: Enter must begin first

            Several things I see, but maybe I'm not getting it.
            1. If you are zapping the table, then why are you having anything to do with change. makes no sense to me.

            2. If you are using the table.get() method to get a pointer to the table, then the table is open (likely with a form) and the t.zap(.t.) will do nothing. Zap() requires exclusive access to the table. You can't run that from a form based on that table or a set that includes that table.

            3. If can run the script from a different form not containg the Search table, then the zap will work, do a table.enter_begin()-enter_end(.t.) and then open the browse. Since you are zapping the table, the only thing in the browse will be what you just added to the Search table.

            If I am understanding what you are trying to do.
            Mike W
            __________________________
            "I rebel in at least small things to express to the world that I have not completely surrendered"

            Comment


              #7
              Re: Enter must begin first

              Thanks for you reply.

              1. At one point, I was trying to change the existing records instead of zapping and entering new records. Now, the only reference to change is when I make sure that nothing has left the table in change mode. I don't know of anything that would; it is just a check.

              2. Hmm, that does make sense. Now I wonder how it does manage to zap the table... I did have problems with it not zapping the table at one point, but I got that quickly cleared up. (I don't remember how, exactly.) Now, I think that even when the enters aren't working, it still zaps the table. Maybe I found a loophole in the A5 code? By the way, the table is an A5 Native Table, if that makes any difference.

              3. While that does sound like it would work, I don't really want to separate the search criteria from the results. It just makes sense to put them on the same form! Alpha Five should be flexible enough to change tables while they're open, I would think. After all, that's what they do with active-link tables, correct? (I don't really know, since I don't use them.) By the way, are you saying that the table just needs to be zapped from another form, or that the records need to be entered from a different form as well. If just the zap needs to be moved, I could easily zap the search table before I open the search form, I would think.

              A very interesting point you brought up. I'm curious as to the validity of it. By the way, the form is currently working. I guess that four-day weekend gave it just the rest it needed! ;)

              Comment


                #8
                Re: Enter must begin first

                Hi Jacob,
                Whatever you might have going on that is working, I can be 100% sure that
                Code:
                SearchTable = Table.Get("Search")
                SearchTable.Zap(.t.)
                is not going to work.

                Tom Cone sent you an email, I believe. You should read it and pay very close attention to what he has to say.
                But, all in all, glad you got it to... work.
                Mike W
                __________________________
                "I rebel in at least small things to express to the world that I have not completely surrendered"

                Comment

                Working...
                X