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

Dynamic List To Show Only Marked Records

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

    Dynamic List To Show Only Marked Records

    I have a customers form with no browse on it to show all customers. I have a mark button to mark the current record after selecting it by a "Find" field. This is use to batch print and email customers historry.

    I would like a way to show the user all the marked customers, I'm not sure how to go about this, should it be a broswe based on another table called "marke_customers", can they all be placed in a variable, then after that how do I placed them in there and also have them removed if the user decides to unmark a customer?

    Any thoughts anyone?

    #2
    Re: Dynamic List To Show Only Marked Records

    Nigel,
    It all depends on how you or your users want it done. You can have a browse, mark the records and use a query to show the records. Or if a list is wanted that can be say placed on a form, you can use the form level methods to fetch through the records and create a crlf list....or use table methods behind the scenes if you have a different way to mark records and you just want the crlf list generated. I don't think there is an advantage with either except the fetching through a browse may take longer if a lot of records or over a network.

    Removing them can be just an operation or a slower way, a fetch through record script.

    I'll be off here most of the day but when you decide which of the multitude of ways to do this let us know and if noone else helps, I'll check back tonight.
    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


      #3
      Re: Dynamic List To Show Only Marked Records

      Thanks for the offer Mike, I really need assistance. I got so frustrated with that feature I just undo all and decide to leave it out.

      But since there's no customer's browse on that form I think it's like working in the dark after a while trying to remember who has been marked so far and who hasn't. The only way to tell is to build the report and check. That's not very efficient.

      The method that took me the farest was when I created a table called "Customers_marked" I placed some codes under the "Mark" button to copy each customer from the customer's table to this new table as its being marked.
      That worked eventually, but then when I try to get the "Un Mark" button to also delete the selected customer from the "Customers_marked" table, I ran into all sorts of errors. And it got worst when I tried to Use the "Un Mark All" button along with the "Zap Table" code, that one will never work, because the "Customers_marked" table is in use.

      I read you options a few times and I'm a bit disappointed in myself to say this, but those I don�t understand. Please select an option for me, which ever one that doesn't really copy the marked records to another table, but just dynamically show them then on the form, it doesn't matter to me if it's a brows, a RTF, or anything else. But I need a record to leave the list when it is unmarked.

      Thanks again, I await your response.

      Comment


        #4
        Re: Dynamic List To Show Only Marked Records

        Hi Nigel,
        Took a while to get back to this--I have both ways...browse and table methods working.

        From what you have said, it sounds like you would like to have this done from a form's button and No browse.....so I need just a few bits of info from you in order to customize the script.

        First create a Memo field (if you don't have one for the list)--let me know if it is going to be on the form or just in the table...makes no difference but need to know.

        Memo field name (and what table if not the same):.....?

        Table name:.....?

        Table Field's name that is to go into the list:.....?

        May be prudent to tell me your set structure especially if there is one, where does the table in question reside?

        Once I have this info I will place it accordingly in the script.
        Last edited by MikeC; 09-15-2008, 01:23 AM. Reason: More info maybe needed.
        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


          #5
          Re: Dynamic List To Show Only Marked Records

          If the memo field is to show the marked customers, then I�ll deffinately place it on the form.

          The name of the Table is �Consignee�
          The ID = Consign_Id
          Name Field = Consign

          The set is: consignee_shipments
          The Consignee table is the parent.

          The nma of the form is : Consignee


          I�m not sure I understand the memo field part, but if I have given you enough, then please fill in the rest and I�ll make the changes to mines to match yours..

          You said �done from a form's button and No browse�, the only brows that may be on the form is if you place one there to show all the marked consignees.

          If there�s anything other detail you need, please feel free to let me know.

          Thanks for you assistance.

          Comment


            #6
            Re: Dynamic List To Show Only Marked Records

            Hi Nigel,
            Please attempt to understand the script to see how it is done--I commented it to try and make it easier to follow...any questions, just ask. Quite a bit of code can be obtained via action scripting and then converting to xbasic--quite a bit of what follows is just that.

            You said you wanted to see the marked records. The two easiest ways I know of are to use a browse (queried for marked records from a button usually) or a memo field. The following uses a memo field on a parent form.

            So create a memo field in your parent table (Consignee) called a_Memo and place it on your form.

            Place the following code on a button's OnPush event --you can use the InLine xbasic Action Script.

            Code:
            topparent:a_Memo.value=""
            topparent.commit()
            
            dim t as p
            DIM records_found as N
            dim global lst as c 'may not need to be global
            
            lst=""
            t = table.open("Consignee")
            
            query.filter = "marked()"
            query.order = "Consignee"   'could have used "recno()"
            query.options = ""
            query.description = ""
            
            t.query_create() 'uses the above filter and order
            
            'tells us how many records will be found
            records_found = A5_GET_RECORDS_IN_QUERY("Consignee","marked()")
            
            ' if any records are found it will fetch through the records of the query
            '    until the last record is reached --eof means "end of file"
            'if no records, then messagebox comes up
            if records_found>0
                t.fetch_first() 
                while .not. t.fetch_eof()
                      lst=lst+crlf()+t.Consign ' 'takes the list and adds itself to the next marked
            ''                                           value-the crlf() is a carriage return line feed
            ''                                          This puts the next value on separate line which 
            ''                                           becomes a crlf list.
                      t.fetch_next()
                end while
              else
                msgbox("There are no Marked records!")
            end if
            
            t.close() 'closes the table
            lst=remove_blank_lines(lst) 'removes any blank lines in the list
            
            topparent:a_Memo.value=lst  'sets the list values into the memo field
            topparent.commit()
            ++=========================+++====================++
            Now if a browse is used to view the records the following could be used--your browse name would have to be used in place of the ones in the code (in red). If a memo field is to be used in conjunction with the browse on the same form then you also need to add the memo field as before and change the column name of what would be on the list (the one associated with the "Consignee" field...they are highlighted in blue below.

            If all that is wanted is the browse to be queried for the marked records then just use
            topparent.queryrun("marked(\"Consignee\")","","","No","",.f.)
            It was taken from the code generated from an action script for a query is all.


            Code:
            DIM records_found as N
            dim rec_num as n
            dim global lst as c
            lst=""
            records_found = topparent.queryrun("marked(\"Consignee\")","","","No","",.f.)
            if records_found>0
                topparent:[COLOR=Red]browse5[/COLOR].fetch_last()
                rec_num=recno()
                topparent:[COLOR=Red]browse5[/COLOR].fetch_first()
            
                lst=topparent:[COLOR=Red]Browse5[/COLOR]:[COLOR=RoyalBlue]Your_Column_name[/COLOR].value
            nxt:
                if recno()<>rec_num
                   topparent:DIM records_found as N
            dim rec_num as n
            dim global lst as c
            lst=""
            records_found = topparent.queryrun("marked(\"Consignee\")","","","No","",.f.)
            if records_found>0
                topparent:[COLOR=Red]browse5[/COLOR].fetch_last()
                rec_num=recno()
                topparent:[COLOR=Red]browse5[/COLOR].fetch_first()
            
                lst=topparent:Browse5:[COLOR=RoyalBlue]Your_Column_name[/COLOR].value
            nxt:
                if recno()<>rec_num
                   topparent:[COLOR=Red]browse5[/COLOR].fetch_next()
                   lst=lst+crlf()+topparent:[COLOR=Red]Browse5[/COLOR]:[COLOR=RoyalBlue]Your_Column_name[/COLOR].value
                   goto nxt
               end if    
               topparent:a_Memo.value=lst
               topparent.commit()
             else
               msgbox("There are no Marked records!")
            end if.fetch_next()
                   lst=lst+crlf()+topparent:[COLOR=Red]Browse5[/COLOR]:[COLOR=RoyalBlue]Your_Column_name[/COLOR].value
                   goto nxt
               end if    
               topparent:a_Memo.value=lst
               topparent.commit()
             else
               msgbox("There are no Marked records!")
            end if
            An Operation to unmark all records can easily be done and then run from the same button or a separate one.

            EDIT: UnMark records--can also be done with this code. Only open the table again only if using this code separate from the above Table method.
            dim tbl as p
            tbl=table.open("Consignee")
            tbl.unmark_range(".T.")
            tbl.close()
            topparent:a_Memo.value=""
            topparent.show_all()
            Last edited by MikeC; 09-15-2008, 11:06 AM.
            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


              #7
              Re: Dynamic List To Show Only Marked Records

              Hey mike, thanks for setting that up for me mein. But due to the fact that i try to avoide codes as much as possible from day 1. I really dont understand your samples.

              Is it possible to send me the project? I'll get the action scripting, then i'll be able to modify it if needs be.

              Comment


                #8
                Re: Dynamic List To Show Only Marked Records

                Originally posted by nigeldude View Post
                The method that took me the farest was when I created a table called "Customers_marked" I placed some codes under the "Mark" button to copy each customer from the customer's table to this new table as its being marked.
                That worked eventually, but then when I try to get the "Un Mark" button to also delete the selected customer from the "Customers_marked" table, I ran into all sorts of errors. And it got worst when I tried to Use the "Un Mark All" button along with the "Zap Table" code, that one will never work, because the "Customers_marked" table is in use.
                Hey Nigeldude,

                I think this method you describe is not bad for what you are trying to do. Maybe it just needs refinement? Here's how I would do it using your method:
                1. On your main customer table have a button that copies the record to your "marked" table. But don't actually "mark" any records on the main table - just copy them.
                2. On you marked table, have an embedded browse on a form w. a delete button. You can call the button: "remove form marked list", but really the button just deletes the current record from the "marked" table.
                3. If you want to delete all "marked" records - use the RECORD_DELETE() function. e.g.
                RECORD_DELETE("marked_table_name",.T.)
                Peter
                AlphaBase Solutions, LLC

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


                Comment


                  #9
                  Re: Dynamic List To Show Only Marked Records

                  So what ur saying then Peter is; the batch processing would be run from the records in the marked table, and not from the main table?

                  Comment


                    #10
                    Re: Dynamic List To Show Only Marked Records

                    Originally posted by nigeldude View Post
                    So what ur saying then Peter is; the batch processing would be run from the records in the marked table, and not from the main table?
                    Correct. Basically you never touch the main table. You just copy records from there as you have been doing in the past.
                    Peter
                    AlphaBase Solutions, LLC

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


                    Comment


                      #11
                      Re: Dynamic List To Show Only Marked Records

                      I'll try that and see if it works, but I also sent my project to Mike to let him include the actions for, I'll compare the pros and cons of them both.

                      Thanks mein.

                      Comment


                        #12
                        Re: Dynamic List To Show Only Marked Records

                        Hi,
                        Always so many ways to tackle a problem and many times it does simply come down to personal preference. I prefer the browse if I were to do this with the ability to mark records directly or via a button and then being able to just show those records or all records when wanted. Or in combination with a memo field.

                        It seemed like what was wanted just a memo field on a form so that is what I sent him---but the script is mostly done for a browse if the desire arises. Peter or someone else can help with the temp/secondary table. :)

                        One note is that Referential Integrity is set on a couple of the tables in the involved set and commonly linked--I was able to get my script to work but the Mark and UnMark buttons would lock the tables most times unless it was turned off--on a network I think it may even be worse for locking.??
                        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

                        Working...
                        X