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

Query Problem

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

    Query Problem

    Hi

    I want to look at records in a browse table that are duplicates, I have tried using the following expression

    previous("index_field")="index_field"

    but without any luck. I don't want to use the view duplicates genie as I want to make changes to the duplicate records as I view them, I really just need to see the master record along with any duplicates in the browse table.

    Can anyone help.

    Thanks

    Judith

    #2
    Re: Query Problem

    Would a simple sort do?

    Comment


      #3
      Re: Query Problem

      Judith,

      There may be a more elegant solution, but if no one suggests an alternative consider pre-processing the child table in order to "mark" the records that have been duplicated. You could do this with a script that has two steps:

      a) unmark all the records in the table, using a saved unmark operation
      b) mark the duplicates using a saved mark operation and a filter based on the dbcount() function. i.e. mark records where dbcount() is greater than 1.

      Then filter the child table in your form to only show marked records.

      -- tom

      Comment


        #4
        Re: Query Problem

        Hi,

        A simple sort wouldn't work because I would have all the records in the table not just the master record and its duplicates.

        I have tried the suggestion from Tom and unmarked all the records, but if I carry out this instruction, wouldn't I just end up with the marked duplicates in the browse table but still not be able to view the master record. Sorry if I sound a bit dumb, but I am quite new to all this, I am very much a user rather than a techie. Thanks.

        Comment


          #5
          Re: Query Problem

          Tell us what you mean by the "master record".

          I was assuming you have a two table set, with the "master" record in the parent table, linked one to many to the child table. A form based on this kind of relationship could include fields from the parent table, and an embedded browse object displaying the child table records. The child table could be filtered to display only the marked records.

          It now sounds to me as though you mean something else. Please clarify. Give us an example to illustrate the explanation.

          -- tom

          Comment


            #6
            Re: Query Problem

            Tom:
            I think what Judy wants is a way to ONLY show those records and their duplicates.

            For example, if you have a table with the following values in field_A

            A
            B
            C
            C
            D

            She wants to filter the table to only show:
            C
            C

            It's doable with a script, or possibly a trick, but for now, I have to go to my dentist.

            Comment


              #7
              Re: Query Problem

              G, you may be right. But she also wants to show something she calls the "master record" associated with the duplicates... I'm waiting on clarification and hopefully she'll provide an example that can bridge the language barrier between Brits and Yanks <grin> -- t

              Comment


                #8
                Re: Query Problem

                Tom:
                If you mark duplicates and filter for marked records, alpha will only mark the duplicate record. So, in the previous example you will end up with:
                A
                B
                C .....she is refering to this as "Master"
                C (marked) .....she refers to this as the "duplicate"
                D

                If you filter for marked records, you will see only the marked one, but not it's pair. She is refering to the original record as the "master". She wants to be able to see both the marked as well as the unmarked duplicates.

                Quite frankly I am not sure what is the purpose of this. Typically you want to do something with the duplicate, what would you want to do with both? Who knows. But nonethless, I think that's what she is looking for.

                Comment


                  #9
                  Re: Query Problem

                  Hi,

                  Have been to lunch and have seen you both trying to get me sorted on this, thank you. I do mean records in just one table and wanting to view the unmarked record and it duplicates:

                  I have attached a screenshot to show the field I am working on, hope this helps.

                  Comment


                    #10
                    Re: Query Problem

                    Originally posted by Judith View Post
                    Hi,

                    Have been to lunch and have seen you both trying to get me sorted on this, thank you. I do mean records in just one table and wanting to view the unmarked record and it duplicates:

                    I have attached a screenshot to show the field I am working on, hope this helps.
                    This should mark all records which have duplicates in the index_field. Change the first line to reflect the name of your table.

                    Code:
                    tbl = table.open("[COLOR="Red"]check[/COLOR]",FILE_RW_EXCLUSIVE)
                    tbl.unmark_range()
                    query.order = "index_field"
                    query.filter = ""
                    query.description = ""
                    query.options = "I"
                    tbl.query_create()
                    tbl.fetch_first()
                    ind = tbl.Index_field
                    tbl.fetch_next()
                    while .not. tbl.fetch_eof()
                    	if tbl.Index_field = ind
                    		tbl.fetch_prev()
                    		tbl.change_begin()
                    		tbl.mark()
                    		tbl.change_end(.t.)
                    		tbl.fetch_next()
                    		tbl.change_begin()
                    		tbl.mark()
                    		tbl.change_end(.t.)
                    	end if
                    		ind = tbl.Index_field
                    		tbl.fetch_next()	   
                    end while
                    There can be only one.

                    Comment


                      #11
                      Re: Query Problem

                      Stan, good morning.

                      Your approach resembles what I suspect is going on under the hood with

                      <tbl>.mark_dups2()

                      -- tom

                      Comment


                        #12
                        Re: Query Problem

                        Originally posted by Tom Cone Jr View Post
                        Stan, good morning.

                        Your approach resembles what I suspect is going on under the hood with

                        <tbl>.mark_dups2()

                        -- tom
                        Looks to be so. I'm still doing most of my work in V5 so I'm not at full speed on functions and methods introduced in later versions. Thanks for the heads up.
                        Last edited by Stan Mathews; 04-16-2007, 11:05 AM.
                        There can be only one.

                        Comment


                          #13
                          Re: Query Problem

                          Hi Stan,

                          I have copied and pasted the code you kindly sent. I have amended the first line to read:

                          tbl = codata_1.open("check",FILE_RW_EXCLUSIVE)

                          where codata_1 is the name of the table I am working on, but I am getting an error message which says:

                          line:5
                          tbl = codata_1.open("check",FILE_RW_EXCLUSIVE)
                          Not found
                          codata_1 not found.

                          Sorry I am making heavy weather of this aren't I.

                          Comment


                            #14
                            Re: Query Problem

                            Should be

                            tbl = table.open("codata_1",FILE_RW_EXCLUSIVE)
                            There can be only one.

                            Comment


                              #15
                              Re: Query Problem

                              Tom, thank you so much for all your help, the job I needed to done can be completed this afternoon which would have taken me days.

                              Comment

                              Working...
                              X