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

Goto record key

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

    Goto record key

    I have a form where I select a record and I want to set the record of another form the same as the first form...

    I have the following xbasic code:

    'Get 'Value' property of 'Browse2:Order__' in Form 'SearchBySender' .
    DIM SHARED VcOnum AS n
    VcOnum = topparent:Browse2:Order__.value

    'Goto record with specified key value in Form 'SearchOrder' .
    DELETE var_key_target
    var_key_target = VcOnum

    DIM object_name as C
    object_name = ":"+"SearchOrder"
    DIM varP_Object as p
    'Get a pointer to the specified object
    varP_Object = obj(object_name)
    'Check if the specified object exists
    if .not. is_object(varP_Object) then
    ui_msg_box("Error","The object '"+object_name+"' does not exist.",ui_stop_symbol)
    else
    varP_Object.find(var_key_target)
    end if

    when it get to the line
    varP_Object.find(var_key_target)
    I get the following error:

    "Script:on puch:line ## varP_Object.find(var_key_target) confilcting expression data types"

    The thing is sometime the script works sometime I get this error...

    Thanks for the help


    #2
    RE: Goto record key

    Judith,

    I do something similar. In my case, I have a form with an embeded browse which is a list of names. In the browse, I have a double click event and a right click menu that opens the person's record and displays the details. The code is:

    Dim vList_Id as C
    Dim vName as C
    Dim vMsg as C
    Dim vAnsr as N
    Dim frm as P
    vList_Id=table.current(1).list_id ' get the proper list
    if .not. exist(vList_Id,"pers_list","list_ID")
    vMsg="There are no People in this List to view."
    ui_msg_box("NO PEOPLE",vMsg,UI_INFORMATION_SYMBOL+UI_OK)
    end
    end if
    vName=alltrim(topparent:persbrowse:full_name.value)
    if is_object(":person")
    frm=obj(":person")
    frm.restore()
    else
    frm=:form.load("person")
    end if
    frm.index_set("full_name")
    frm.find(vName)
    frm.resynch();frm.show()
    frm:lastname.activate()
    end

    One more thing, the form should be in View mode before running this code, so you might want to add code to make sure you are not in change or enter mode.

    Pat
    Pat Bremkamp
    MindKicks Consulting

    Comment


      #3
      RE: Goto record key

      I think the .find() method for a form does a find by key. It will do the search using the current index sort order of the form. If you pass the method a search key that is numeric (like you do here) and the current controlling sort sequence for the form is not based on a numeric field the find method will throw an error. I suggest that once your script verifies that the form is active you check and / or change it's primary index before doing the find.

      -- t

      Comment


        #4
        RE: Goto record key

        That's too complicated for me to follow. I'd guess that code is mostly coming from a conversion of Action Scripting - seldom a "clean" result. Bullet-proof? Probably. Clean? No. With code like that, it's no wonder people are scared away from xbasic. Here's what I did to jump to a record in a child table.

        crec = parentform:tables:child_table_name.recno()
        fp = form.view( "Action_items" )
        fp.Recno_goto( crec )

        The nice thing about this method is that I don't care what the index is.

        Now, if you want to see if the other form is already open:

        crec = parentform:tables:child_table_name.recno()
        fp = obj( "Action_items" )
        IF is_object( fp )
        fp.activate()
        fp.show()
        ELSE
        fp = form.view( "Action_items" )
        END IF
        fp.Recno_goto(crec)

        By the way, that was not a cheap shot at Action Scripting or at the code generated. The needs of AS are much different and require this kind of what I call "protective" code because the AS might be used by anyone, anywhere, for any purpose. This means that extra care has to be taken to make sure it works correctly in all circumstances. If you know exactly what needs to be done, the code can often be cleaned up quite a bit.

        Cal Locklin
        www.aimsdc.net

        Comment


          #5
          RE: Goto record key

          Cal,

          I prefer "simplified" or "streamlined" to "cleaned up", but I've noticed the same thing and agree with you. -- t

          Comment


            #6
            RE: Goto record key

            " I have a form where I select a record and I want to set the record of another form the same as the first form... "

            I am not sure why all the DIMing and all the rest..how about a simple saved update operation that will update the fields of the other form according to the fields of the first one? I hate DIMing, keep the light bright and shine!
            Gabe

            Comment


              #7
              RE: Goto record key

              g,

              It's true that you can use a saved update operation to change the field values in a single record of a table. Doing this requires Alpha to run a query to filter that table, and does not open a data entry form for the user. The query will work but is often slower than Cal's approach. Leaving the called form open seems to be part of what Judith needs.

              -- t

              Comment


                #8
                RE: Goto record key

                Tom:
                I meant to create a saved "update" operation that has the filter built in it. In other words, when you run the operation, it will update based on that filter, no need to do querry first then update and therefore you could keep your form open!
                Gabe

                Comment


                  #9
                  RE: Goto record key

                  Thanks for all the input, I have not been online for a while that is why the long time to see the feedback I got...

                  Will look at the sugestion and see what I can do..

                  And the script I have there is a conversion of action scripting...

                  I did that thinking that it would work better then action scripting since action scripting was giving me the same error

                  Thank again

                  Judith

                  Comment


                    #10
                    RE: Goto record key

                    Gabe,

                    Exactly my point.

                    -- t

                    Comment


                      #11
                      RE: Goto record key

                      Tom:
                      To update the second form, by action script, xbasic or any other kind of majic, you must by some means or another identify the record you want to update, IOW, you will need a filter somehow. What am I missing?
                      Gabe

                      Comment


                        #12
                        RE: Goto record key

                        gabe,

                        You need not filter the entire table just to "find" a single record.

                        Cal's approach "finds" the record using its recordnumber. You can also use find by key. These methods will often be faster than the process of filtering the entire table just to find a single record. the table is never filtered. Instead the record pointer is moved very very quickly to the desired record in the unfiltered table.

                        It's true you can do it with a saved (filtered) update operation. But operations by their very nature are designed to run against an entire table.

                        -- t

                        Comment


                          #13
                          RE: Goto record key

                          Tom:
                          I am not sure Cal's approach will work. Cal wrote:
                          "Here's what I did to jump to a record in a child table."
                          and then he goes on:
                          "Now, if you want to see if the other form is already open:"
                          Now, assume the second form to which he wants to go is not open, then how do you get the recno of that specific record??? Do not tell me you are going to use a filter?!
                          furthermore,
                          Cal's approach involoes the following steps:
                          1-first get the child's recno
                          2-then open the form if not open and activate it
                          3-then go to that child record based on the record number
                          4-then update the fields based on the values from the first record which you had to declare as variables in the begining!
                          Aren't we reinventing the wheel?
                          Gabe

                          Comment


                            #14
                            RE: Goto record key

                            Nope.

                            -- t

                            Comment


                              #15
                              RE: Goto record key

                              gabe, in case my previous succinctness didn't clarify (and I'd be surprised if it did!), let me try again.

                              Cal is pulling the record number of the child table record from the current form. He does not have to open the second form (based on child table alone) in order to get the record number, as you seem to be thinking. No filter has to be applied there. He jumps to the desired record with the fetch_goto() method. The same thing can be done easily using a find by key. Both of these are preferable to using a saved update operation that must filter the records in the child table, and which prevents the user from making manual edits there, as well.

                              -- t

                              Comment

                              Working...
                              X