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

Move rec from one tbl to another...

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

    Move rec from one tbl to another...

    Hi,everyone. Can anyone help me with this-I have a form set opened with two tables on it & one variable where I enter barcode. I would like to search for that barcode in tbl2 and when/if found-move it to tbl1. If the search doesn't find anything then just add the barcode from variable to tbl1.
    www.zeljkobobic.com

    #2
    Re: Move rec from one tbl to another...

    I don't think you need to use a set based form for this.

    Using a form based on Tbl1 you could put a button on it which:
    a) uses find by key to do an indexed search for the barcode in tbl2
    b) if found, assigns field values from the found record to the fields in the current record displayed in the form
    c) if not found assigns only the barcode value (from your variable) to the relevant field displayed in the form

    Comment


      #3
      Re: Move rec from one tbl to another...

      Maybe I explained this too simple. In Tbl2 I have all barcodes of lets say products-about 100.000 of them. I need a quick way to scan a product(it's barcode is written in Var1) then to search in Tbl2 for that barcode,if found copy-to-Tbl1-erase, if not copy Var1 to Tbl1.
      In Clipper S87 I did it very easy...
      do while !eof
      seek var1
      iffound Tbl1(field)=Var1
      delete record
      else
      Tbl1(field)=Var1
      endif
      enddo

      But in Alpha I cannot make operations or functions to work. Further more I cannot use any additonal buttons because I work only with scanner so all events must be like 'on arrive' or 'on depart' (got focus & lost focus) on field.
      Please give me some advice.
      www.zeljkobobic.com

      Comment


        #4
        Re: Move rec from one tbl to another...

        Hello again.

        I thought you wanted to "move" field values from tbl2 into a record in tbl1 if the barcode value in your variable was found in tbl2. What exactly do you mean by:

        copy-to-Tbl1-erase

        The clipper code doesn't do any copying. Or am I missing something here?

        -- tom

        Comment


          #5
          Re: Move rec from one tbl to another...

          Here's an example that illustrates what I think you're talking about, except it runs from a button, not from a barcode scanner. Hope it gives you some ideas.

          Comment


            #6
            Re: Move rec from one tbl to another...

            Zeljko,
            Expanding on Tom's suggestion.

            Most bar code scanners allow for a pre-amble or a post-amble(is that a word?). These allow you to send control instructions to the receiving form. These are received by the form as standard keyboard key strokes.

            In a preamble you could send say a function key or alt + function key then program the OnKey event of the form to trap these 'key strokes' to run the code Tom has provided.

            Or in a post amble you could send the Enter or tab key. Make sure there is another object on the form that can receive the focus so the barcode field is able to be departed. Put the code in the OnDepart event of the Barcode field. The last bit of your code could set the Barcode variable to "" and return focus to the barcode field.

            Tom,
            I think what Zeljko wants with "copy-to-Tbl1-erase" translating to your example is that if a record is found in the supporting table and subsequently copied to the master that it is then deleted from the supporting table.
            Tim Kiebert
            Eagle Creek Citrus
            A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

            Comment


              #7
              Re: Move rec from one tbl to another...

              Hello, Tim.

              Deleting the found record in the supporting table would be an easy thing to add to my example. Let's see if he can handle it or needs further assistance.

              -- tom

              Comment


                #8
                Re: Move rec from one tbl to another...

                Hi Tom, Agreed!
                Tim Kiebert
                Eagle Creek Citrus
                A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                Comment


                  #9
                  Re: Move rec from one tbl to another...

                  I'll try this right away...
                  www.zeljkobobic.com

                  Comment


                    #10
                    Re: Move rec from one tbl to another...

                    Ok guys I managed to delete found record. But the first look on the example you sent tells me that I am going the wrong way from the beggining. First of all you have a form which is not directly linked to any table,but to empty table dummy-I was doing wrong,always creating form based on the tableset or table itself. I prefer your way, it's much safer for data.
                    Can I please attach my project as a zip file in order for you to point me in the right direction. I have to point out that I'm not asking you to do programming for me, just explain me what to do and I will find how to use the code. Although I'm using Alpha for three weeks now you would be surprised what I managed to create so far.(I have some experince with Clipper,Access and VB5/VB2005).
                    Thanks in advance & thanks for this example.
                    www.zeljkobobic.com

                    Comment


                      #11
                      Re: Move rec from one tbl to another...

                      Are you sure you attached the correct project? This one looks like Tom's example.
                      Tim Kiebert
                      Eagle Creek Citrus
                      A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                      Comment


                        #12
                        Re: Move rec from one tbl to another...

                        well of course it looks the same, but if you check table 'supporting' you'll see that it is deleting the selected barcode. You can also check code on the buttonpush event where I added:
                        tbl2.change_begin()
                        tbl2.delete()
                        tbl2.change_end(.t.)
                        in order to delete found record.
                        www.zeljkobobic.com

                        Comment


                          #13
                          Re: Move rec from one tbl to another...

                          Zeljko, I think Tim and I were expecting you to attach your project, since you said:

                          Can I please attach my project as a zip file...
                          Your modifications to the script look fine. However, you're deleting the record before the new record is committed to the Master table. This assumes the commit won't fail. If I were writing production code, instead of simple example to get you going, I'd include error trapping around the writes to the Master table, and would not delete the "found" record until the commit finished without throwing an error. You probably have experience doing this sort of thing in Clipper. Read the help topics on Error / Handling, and <tbl>.enter_end() for details about how it's done in Alpha Five

                          Comment


                            #14
                            Re: Move rec from one tbl to another...

                            Originally posted by Zeljko View Post
                            well of course it looks the same, but if you check table 'supporting' you'll see that it is deleting the selected barcode. You can also check code on the buttonpush event where I added:
                            tbl2.change_begin()
                            tbl2.delete()
                            tbl2.change_end(.t.)
                            in order to delete found record.
                            :D Yeh, I did See that but like Tom said I thought we were going to get a peek at your effort. So we could see your problem in your context. Much easier to make recommendations if we see what you see. Check out the capability of the scanner you are using or planning to use as far as the pre or post amble. I think that is one of the key things that will determine how you proceed with coding. Start reading up on the OnKey form event. Personally, if possible I would use the post-amble and the OnDepart event as described in my earlier post. This is a case were getting the right hardware(ie scanner) for the job will be half your battle.
                            Tim Kiebert
                            Eagle Creek Citrus
                            A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                            Comment


                              #15
                              Re: Move rec from one tbl to another...

                              What about my suggestion that I zip my project and you see what I did so far. What ever you think I should change, just tell me and I will try to change. I also have some ideas but I need advice how to do it. I have two projects. This previous problem with deleting selected barcode is No2. Project No1 is POS (Point Of Sale) program.I would like to ask you to see this and give me few advices. Maybe if other members check this thread they can also advice me....What do you think about it?
                              www.zeljkobobic.com

                              Comment

                              Working...
                              X