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

How to move one row at a time in a browse

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

    #16
    Re: How to move one row at a time in a browse

    Hello to all:
    All along I was responding to Oscar's quest for moving a row in a browse up or down, permanently. The comments made about sorting, while legitimate, unfortunately will not work.

    What Oscar is attempting to do, as he explained, is to permanently move a row up or down the ranks of a browse so as similar items will line up together. You could say, why not just sort it? then shirts will be line up together then pants and so on?

    Theoretically speaking, you could. Unfortunately, and this being one of the shortcomings of browses in alpha, that will work only if you are showing ALL rows in the browse.

    If your browse is filtered and if you sort it based on any field in the embeded browse, it will sort, BUT, it will show ALL records in the browse, not just the filtered ones.

    There is a way to show only the filtered records and sort them at the same time which require some xbasic, But simply sorting the records will not work if Oscar's browse is filtered somehow and I believe it is since it reflects orders by a certain customer.

    As to Robin's other thread, I have not read it, I will take a look at it if I find it.

    Thanks

    Comment


      #17
      Re: How to move one row at a time in a browse

      Here's the other thread:
      http://msgboard.alphasoftware.com/al...ad.php?t=62595

      I have since modified the script I posted there and put an error trap before the fetch_prev() in the UP button. If the user tries to move above the first record the error trap redirects him to the last record in the browse instead. The DOWN button does the same at the last record but moves to the first record instead. The only part I would still like to change is that the cursor is seen moving back to the original record after it is changed instead of just appearing there. I could probably zip up the tables if anyone is interested.

      The hardest part in trying to do this is to keep the records in the sort order that reflects the new position and put the cursor back on the record that was moved.

      Peter's point about needing a sequentially numbered field is exactly correct. To do that in an invoicing app would be difficult as line items are added. In the model I am working on (Vending Machines), the rows are all added and numbered first and then the product data is copied into them. So switching them around by renumbering them is a bit easier.

      Update: I just reread Stan' post about numbering the line items - that would give you the sequential field needed, providing is not a calc field. The button script could then renumber them similarly to what I did with the lanes. If Oscar would zip some tables maybe we could play with it ;-)
      Last edited by MoGrace; 08-11-2006, 06:00 PM.
      Robin

      Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

      Comment


        #18
        Re: How to move one row at a time in a browse

        Robin:
        I only read the first paragraph of your thread, I did not read your code nor any of the responses as I am pressed for time, Sorry!

        Help me out here: if you are at the very top record in the browse, why would you want to move it up? up where?

        The only reason I could see a need for trapping BOF or EOF is to prevent accidental execution of the script.

        At any rate, I resolved your issue as you see on the up button in the form in the attached zip file. You could repeat the same idea with the bottom button.
        Last edited by G Gabriel; 05-11-2007, 05:19 AM.

        Comment


          #19
          Re: How to move one row at a time in a browse

          Originally posted by MoGrace
          The hardest part in trying to do this is to keep the records in the sort order that reflects the new position and put the cursor back on the record that was moved.
          See the zip file attached. It does just that.

          Comment


            #20
            Re: How to move one row at a time in a browse

            Pretty cool G., I tweaked it a little to work in a set but you have surely eliminated the problems I was having - thanks!
            Robin

            Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

            Comment


              #21
              Re: How to move one row at a time in a browse

              Gabriel's method is very clever. But it relies on maintaining the table in record order and swapping the values of the records themselves. That's fine for a one field table, but if you have a hundred fields it can be problematic, and the minute you query or index - you're out of luck.
              Peter
              AlphaBase Solutions, LLC

              [email protected]
              https://www.alphabasesolutions.com


              Comment


                #22
                Re: How to move one row at a time in a browse

                Oscar,

                If it's a matter of sorting the invoice in an order that you wish, maybe something like the approach in the attached might work. Open the database, Invoice form will load. Push the red button. Choose the desired invoice, double click the rows in the order you wish it displayed (kinda like the arrange form field tab order).

                Mike W
                Mike W
                __________________________
                "I rebel in at least small things to express to the world that I have not completely surrendered"

                Comment


                  #23
                  Re: How to move one row at a time in a browse

                  Peter:
                  That's a good point, in fact I meant to indicate that if any one uses this technique, they must swap ALL FIELDS, otherwise you will end up with a mess.

                  As I mentioned earlier, there is a way to sort the embedded browse and show only the filtered records and that might be the way to do it if you have a large number of fields.

                  Alternatively, if you have a large number of fields, you could send all field values to a blob instead of variables and later import them from the blob.

                  All these issues should resolve, hopefully with the newly engineered browse.

                  Comment


                    #24
                    Re: How to move one row at a time in a browse

                    Peter or Gabriel,
                    Please explain why switching values in the sort field between two records would require that ALL fields in those records be swapped as well. That doesn't seem necessary to me. This proposed script is only "moving" one record at a time.
                    Robin

                    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                    Comment


                      #25
                      Re: How to move one row at a time in a browse

                      Robin:
                      What the script does is take the fields' values of the bottom row and assign them to the top row and vice a versa.

                      if the bottom record is: first name: John Last name: Smith
                      Top record: first name: Mark Last Name: Douglas

                      If you swab the last Name fields only, you will end up with John Douglas & Mark Smith !

                      Comment


                        #26
                        Re: How to move one row at a time in a browse

                        Hi Gabriel,
                        I see what you mean in a scenario like that, but if a special field were added just to sort by, then it would not be a problem and the script could work more generically. Hence Stan's idea of line numbers and Peter's suggestion for some sequentially numbered field. This is what Oscar needs to add to his line items table when the record is added. The field could not be a calc field since its value must remain static. But a calculated value could be passed to the record when it is created. That's about as far as I have gotten in understanding how he might do it. Once each row has a number assigned then it can be swapped.
                        Robin

                        Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                        Comment


                          #27
                          Re: How to move one row at a time in a browse

                          Gabrile: that last scrip works great, but how to refresh the screen as some times it will appears as one of the items got duplicated, and how will I keep the item I am moving higlited all the way during the moving.
                          Thanks

                          Comment


                            #28
                            Re: How to move one row at a time in a browse

                            Not exactly.
                            You could add a field to the table (more like a shadow field for recno) simply for the purpose of sorting but that, as I mentioned earlier, will not work since as I said, sorting the embedded browse with any field will show all the records. Furthermore, it's pretty cumbersome. for example, if you add a field say field1 to sort with and you have an embedded browse showing in field1 the following values:

                            112
                            121
                            159
                            165

                            and let's say you want to move the row that has 159 up in place of the one with 112. How are you going to do that?

                            You could run a find by key query, locate the one with 112 and assign it the number 165, then run a second query looking for 165, in which case there will be two of them! you could resolve that by giving the first record an out of range number like 999999, then find the one with 165 give it the new number of 112, go back to the one with 999999 and re-assign it the final number of 165. And after doing all of that, guess what, when you look at the browse, it will look the same. You might have to close and re-open the browse for the two rows to take their new positions. And since you will end up closing & re- opening the form, then you might as well forget about this newly added field, it serves no purpose, just close and e-open and assign a query script onActivate that will sort the embedded browse.

                            Alternatively, and I hope you are still following me, you could do a hybrid approach wherein you would only swab that field1 value (instead of swabbing the values of all the fields) as in my script, but then again, to see the final result, you would close & re-open which negate that approach.

                            Realistically speaking, if you have way too many fields, or even any number of fields, the best way par none is to use a blob variable.

                            I will see if I could cook up something along these lines.

                            Comment


                              #29
                              Re: How to move one row at a time in a browse

                              The above response was meant for Robin.
                              Oscar:
                              They are not duplicated, it's just two records with the same value.
                              How to keep the row highlighted?
                              Let me think about that.

                              Comment


                                #30
                                Re: How to move one row at a time in a browse

                                Oscar:
                                Here it is with the row being moved is highlighted.
                                Last edited by G Gabriel; 05-11-2007, 05:18 AM.

                                Comment

                                Working...
                                X