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

Read Past End Of File

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

    Read Past End Of File

    I have a button on a form that is suppose to add a record to the child table of the set used to build the form.

    The first part of the code, which i have omitted, displays a dialog box that prompts for a name. It saves the name to variable prompt_var_2

    The next part of the code is listed below.

    Things will work fine...and then tragedy strikes:(

    For some reason, when it gets to tbl.enter_end(.t.) it gives me a "read past end of file" error.
    Code:
    dim tbl as p 
    tbl = table.open("cyc_data")
    tbl.enter_begin(.t.)
    tbl.CYCLE_ID = a5_eval_expression("=Cycle_Id",local_variables())
    tbl.SET_NAME = prompt_var_2
    tbl.enter_end(.t.)
    tbl.close()
    When this error starts happening, I have tried running the code below in the interactive window with the form open, with the form closed, (when i fire the button) etc and i get the error every time.

    I have another form with a button that rebuilds the indexes of the tables of this form (and other forms to boot)

    If I rebuild the indexes, it will once again work...for a while.

    I am not for sure why this problem occurs. Any suggestions would be useful.

    I am also not for sure if i have given adequate info. Please let me know if you need more.

    Thanks
    Tony

    Just in case, I have included the complete code from the button push below:

    Code:
    'Use an Xdialog box to prompt for field values.....
    dim flag_ok_selected as l
    flag_ok_selected = .f.
    '
    DIM  Prompt_var_2 as C
    DIM  ui_get_parameters_result as C
    Prompt_var_2 = ""
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    ui_get_parameters_result = ui_dlg_box("Enter Subcycle Name",<<%dlg%
    {region}
    Set Name:| [.40Prompt_var_2];
    {endregion};
    {line=1,0};
    {region}
    <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
    {endregion};
    %dlg%,<<%code%
    if a_dlg_button = "ok" then 
    	flag_ok_selected = .t. 
    end if 
    
    %code%)
    if ui_get_parameters_result <> "OK" then 
    	end 
    end if 
    
    	
    dim tbl as p 
    tbl = table.open("cyc_data")
    tbl.enter_begin(.t.)
    tbl.CYCLE_ID = a5_eval_expression("=Cycle_Id",local_variables())
    tbl.SET_NAME = prompt_var_2
    tbl.enter_end(.t.)
    tbl.close()
    
    'Refresh  'Cycle_list' in current form.
    topparent:Data_list.refresh()
    topparent:Data_list.fetch_last()
    I have
    
    [CODE]dim tbl as p 
    tbl = table.open("cyc_data")
    tbl.enter_begin(.t.)
    tbl.CYCLE_ID = a5_eval_expression("=Cycle_Id",local_variables())
    tbl.SET_NAME = prompt_var_2
    tbl.enter_end(.t.)
    ERROR: Read past end of file
    
    tbl.close()
    [/CODE]

    #2
    Re: Read Past End Of File

    Ok...I was very wrong about most of what was leading up to my problem. Here is what i have tracked down.

    1. form is built on a set.
    2. I have a button that deletes a parent record and its children. FYI...I have set the referential integrity of the parent-child link to "cascade changes/deletes". This button uses x-basic:
    Code:
    tbl = table.current()
    count = tbl.records_get()
    
    if count = 0 then
        end 
        else
    tbl.change_begin()
    tbl.delete()
    tbl.change_end(.T.)
    3. I have another button that adds a parent record using similar x-basic to the script I posted early in the previous post
    4. I have a 3rd button that adds child records (code shown in previous post)

    Here is how I recreate the error.

    I use the delete button (no. 2 from above) to delete each record until ALL records are deleted.
    I then add a new parent record.
    I then add a child record. No problem!!!
    If i try to add a SECOND child record i get the "read past end of file" error.

    However, if I close the form and pack the child table, I can then open the form back up and add child records.

    Before packing the child table, I can add more parent records, but only the one child record.

    very confused!!!
    T

    Comment


      #3
      Re: Read Past End Of File

      Sorry to be a pest, but I thought I would double check and see if anybody can give me a suggestion on this issue. Unfortunately I am still having the problem.

      Thanks in advance
      Tony

      Comment


        #4
        Re: Read Past End Of File

        Tony, since no one else has responded, I'll jump in.

        The quickest was to get help is to post a sample with instructions how to replicate the problem. You've done a great job as far as explaining how to trigger your problem.

        The question now is

        "Do I have something similar in use where I could try this or do I want to take time to construct a set, using guesswork as to tables involved, field names, etc and hope I make something similar to what Tony is using?"

        Since you see the issue when there are no records in the set, you have no worries about sensitive data. When you get to the point where the set is empty, zip up the set and attach it here for experimentation.
        There can be only one.

        Comment


          #5
          Re: Read Past End Of File

          Hi Tony--it sounds like you have a lot going on and it may be best to try and break it into parts if possible to get to the root of your problem--at least that is how I have been able to figure these things out.

          I would check out you field rules too--especially since you one time chose to explicitly enforce the field rules
          tbl.enter_begin(.t.)
          and in another part of your script you chose not to do so (intentional maybe?).
          tbl.change_begin()
          EDIT: slow does not even come close to describing my condition today!!!! I started this answer a half hour or so ago and just got back to it!!!
          Last edited by MikeC; 01-08-2008, 11:23 AM. Reason: SLOW!!
          Mike
          __________________________________________
          It is only when we forget all our learning that we begin to know.
          It's not what you look at that matters, it's what you see.
          Henry David Thoreau
          __________________________________________



          Comment


            #6
            Re: Read Past End Of File

            Thanks for the help guys.

            I will be away from labtop which has alpha 5 on it until tonight. I will zip the set and post it then.

            I did add some field rules...and to be honest, I cannot say if the problem occured before I added them or not. I will check into that as well.

            Thanks again.
            Tony

            Comment


              #7
              Re: Read Past End Of File

              Alright,
              I have attached the set. Please let me know if I can provide anything else.

              Thanks again.
              Tony

              Comment


                #8
                Re: Read Past End Of File

                Tony,

                In your OnPush event for creating a new subcycle record, use
                Code:
                tbl = table.get("cyc_data")
                instead of table.open----the table is already open as the form is based on the set which has the table.

                Just by changing this the error does not manifest itself and I can add subcycle records.

                Hope it works for you as well.
                Mike
                __________________________________________
                It is only when we forget all our learning that we begin to know.
                It's not what you look at that matters, it's what you see.
                Henry David Thoreau
                __________________________________________



                Comment


                  #9
                  Re: Read Past End Of File

                  In the table cyc_data (child table of set) I have calculated field rules attached to the last four fields. After removing these rules the problem stopped happening.

                  So...I guess that is the problem. However, i really need to run these calculations during data entry. Is there another way to go about this?

                  T

                  Comment


                    #10
                    Re: Read Past End Of File

                    Great. I will try it. I hope it works to:) Maybe I can say "please disregard my last post"

                    Comment


                      #11
                      Re: Read Past End Of File

                      Yippie!!! Problem Fixed!
                      Thank you so much.
                      Tony

                      Comment


                        #12
                        Re: Read Past End Of File

                        Tony--Glad to hear it!! I forgot to mention that you would also eliminate the tbl.close() too as the form is still using the table. You may as well do the same for the add record button for the parent form too.
                        Mike
                        __________________________________________
                        It is only when we forget all our learning that we begin to know.
                        It's not what you look at that matters, it's what you see.
                        Henry David Thoreau
                        __________________________________________



                        Comment


                          #13
                          Re: Read Past End Of File

                          Originally posted by reynolditpi View Post
                          Yippie!!! Problem Fixed!
                          Thank you so much.
                          Tony
                          Tony,

                          Not to say "I told you so" but to point out to others who post questions on the board who might read this thread...

                          You tried for two days to get an answer to your original question. After posting a sample you had a solution in twenty minutes. Is there anything to be learned here?

                          Glad you got it fixed!
                          There can be only one.

                          Comment

                          Working...
                          X