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

fetch_goto() not setting the record. help!

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

    fetch_goto() not setting the record. help!

    I can't seem to make this work. I am trying to allow the user to type in a specific record number and have that record displayed. I tried the following but it doesn't do anything. Debug shows that num is being set to the value entered by the user...?


    Code:
     
    DIM tbl as p 
    DIM num as N
    tbl = table.current()
    
     num = tbl.fetch_goto(val(Main:tif_customer_refinesearch.value))
    I had the above lines of code in the OnDepart Event. I moved them to the OnChange Event and it now works when I give focus to another textbox. If I give focus to a button it doesn't sort...? Weird.

    #2
    Re: fetch_goto() not setting the record. help!

    Jeff:
    I am not sure I understand your script:

    Dim num as N .................'that's easy
    ........................'now you assign the following value to num
    num = tbl.fetch_goto(val(Main:tif_customer_refinesearch.value))

    What do you mean?

    tbl.fetch_goto() is not a numeric value, it is not a value at all. It's a command. It simply tells alpha to go to to the record that has that recno and do something, but is is not a value.

    It should be:
    tbl.fetch_goto(val(Main:tif_customer_refinesearch.value)) 'no need to dim nor use num
    And why does tif_customer_refinesearch have to be character only to be later transformed to numeric? I am assuming it's a variable on the form "Main".

    Comment


      #3
      Re: fetch_goto() not setting the record. help!

      Originally posted by G Gabriel View Post
      tbl.fetch_goto() is not a numeric value, it is not a value at all.
      It sure is, per the documentation.

      Found_Record_Number as N = <TBL>.FETCH_GOTO( Record_Number as N )
      There can be only one.

      Comment


        #4
        Re: fetch_goto() not setting the record. help!

        Stan:
        It is and it defies logic!
        You are telling alpha:
        go to recno 10 and tell me what is the recno of that record ?!!

        akin to saying:
        dim x as n
        t=table.current()
        x=t.fetch_goto(10)
        ?x
        =10

        What else did you expect x to be?! you already sent alpha to recno 10! why don't you just say:
        x=10

        Comment


          #5
          Re: fetch_goto() not setting the record. help!

          FYI

          It is rather strange that the function returns the record number so I thought maybe it would return something like 0 or a negative number if the 'input' number was outside the range of records. Wrong - it just returns an error:

          t=table.open("letters")
          t.index_primary_put("")
          t.fetch_last()
          ?t.recno()
          = 74
          ?t.fetch_goto(50)
          = 50
          ?t.fetch_goto(500)
          ERROR: Record number is past end of table

          This is probably a case of changing the way the function worked as it was being developed. (Not that I'd ever do something like that but I try to understand when others do.:) )

          Comment


            #6
            Re: fetch_goto() not setting the record. help!

            Oops... I meant to post this comment friday. Got sidetracked and forgot to submit it.

            Originally posted by G Gabriel View Post
            Jeff:
            I am not sure I understand your script:

            Dim num as N .................'that's easy
            ........................'now you assign the following value to num
            num = tbl.fetch_goto(val(Main:tif_customer_refinesearch.value))

            What do you mean?

            tbl.fetch_goto() is not a numeric value, it is not a value at all. It's a command. It simply tells alpha to go to to the record that has that recno and do something, but is is not a value.

            It should be:
            tbl.fetch_goto(val(Main:tif_customer_refinesearch.value)) 'no need to dim nor use num
            And why does tif_customer_refinesearch have to be character only to be later transformed to numeric? I am assuming it's a variable on the form "Main".
            Hey Gabe,

            tbl.fetch_goto() returns the number of the record it was told to goto IF the record exists. It also accepts a numeric value that specifies the number of the record you want to goto. The definition of the method is below:

            Code:
            Found_Record_Number as N = <TBL>.FETCH_GOTO( Record_Number as N )
            You're right about the variable num, it was there for debugging purposes, you can omit that. :) Main:tif_customer_refinesearch is a character field on my form. I had to convert it's case so fetch_goto() could use it's input. Main:tif_customer_refinesearch is part of a search utility. It works in conjunction with a dropdown box that contains the names of all the fields on the form. The user can select a field from the dropdown box which sorts the table on the selected field. The user can then type some input into Main:tif_customer_refinesearch to find records that have specific data in the particular field selected in the dropdown.
            Anyway, I'm using fetch_goto() in the OnChange event of a text field. I originally had it in the OnDepart event. It didn't work in the ondepart event. It works in the OnChange event but it only works if I give focus to another text field. If I give focus to a button nothing seems to happen. (The script does execute) Weird? Anybody ever had this problem?

            Comment


              #7
              Re: fetch_goto() not setting the record. help!

              Jeff, I try hard to design my apps so that the record pointer is never moved while a form is in change mode. This seems to be what you're doing on purpose. Is very puzzling to me that you don't save the change before navigating to a different record. -- tom

              Comment


                #8
                Re: fetch_goto() not setting the record. help!

                Originally posted by Tom Cone Jr View Post
                Jeff, I try hard to design my apps so that the record pointer is never moved while a form is in change mode. This seems to be what you're doing on purpose. Is very puzzling to me that you don't save the change before navigating to a different record. -- tom
                Tom,

                Thanks for the input. Would this code be sufficient? Or is there a better way?

                Code:
                DIM tbl as p 
                DIM num as N
                DIM mode as N
                 
                tbl = table.current()
                mode = tbl.mode_get()
                 
                IF (mode == 1)
                   tbl.change_end(.t.)
                ELSE IF (mode == 2)
                   tbl.enter_end(.t.)
                END IF 
                
                tbl.fetch_goto(val(Main:tif_customer_refinesearch.value))
                Or is it better to do it this way?

                Code:
                IF (tbl.mode_get() > 0)
                   parent.commit()
                END IF
                Last edited by Jeff@Listbrokers; 01-08-2007, 12:40 PM.

                Comment

                Working...
                X