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

This Should be easy...... I thought

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

    #16
    So, Madtowng..... I tried the script you wrote and it Put a .T. on all the records. Too funny, before it was all .F. Here's the script:

    dim tbl2 as P
    dim otherValue as C


    tbl2 = table.open("dup_check")


    'PleaseWait(.T.)

    tbl2.fetch_first()
    while .not. tbl2.fetch_eof()

    tbl2.change_begin()
    otherValue = LOOKUPC("F",dup_check->ref,"ref_","ameregl3","ref_")
    dup_check->dup = if(otherValue = dup_check->ref,.T.,.F.)
    tbl2.change_end(.t.)
    tbl2.fetch_next()

    end while
    'PleaseWait()


    END​

    I'll take a look at the other examples provided and see what I can see. Thanks again to all who have contributed, it is much appreciated.

    Scott

    Comment


      #17
      Scott,

      It often helps to have some sanitized data for testing purposes.
      So , for now, I created a couple dbf tables, nothing exciting, but
      enough to confirm it works as expected. (You will need to make a few changes for your needs).

      Code:
      dim tbl2 as P
      dim otherValue as C
      debug(1)
      
      tbl2 = table.open("masterdbf")
      
      
      'PleaseWait(.T.)
      
      tbl2.fetch_first()
      while .not. tbl2.eof()
      if tbl2.eof() then
      debug(1)
      end if
      tbl2.change_begin()
      otherValue = LOOKUPC("F",tbl2.ref,"ref","olddbf","ref")
      tbl2.dup = if(otherValue = tbl2.ref,"T","F")
      tbl2.change_end(.t.)
      tbl2.fetch_next()
      
      end while
      if tbl2.eof() then
      tbl2.change_begin()
      otherValue = LOOKUPC("F",tbl2.ref,"ref","olddbf","ref")
      tbl2.dup = if(otherValue = tbl2.ref,"T","F")
      tbl2.change_end(.t.)
      end if
      tbl2.close()
      debug(1)​
      Gregg
      https://paiza.io is a great site to test and share sql code

      Comment


        #18
        Thx Madtowng for the effort. I always have a "testing" version of my database to work with. I never use my live db. When I get back to the office on Monday I'll change what I need to and give it a go. Thanks again!

        Comment


          #19
          well… there’s test data (a subset of your live data not meant for the world to see) and there’s sanitized data (data safe for the world to see).

          For the purpose of this issue, i created 2 dbf tables with 10 rows of 5 letter ref ids.
          Gregg
          https://paiza.io is a great site to test and share sql code

          Comment


            #20
            Just to try it, I am seeing about putting the dupe test in a Calculated Field on the main table.
            Dinner got in the way.
            See our Hybrid Option here;
            https://hybridapps.example-software.com/


            Apologies to anyone I haven't managed to upset yet.
            You are held in a queue and I will get to you soon.

            Comment


              #21
              With this code, you'll still need to create the tables, but this will populate both tables
              before doing the dup check. (Keep in mind, I didn't get to my current weight being overly ambitious)

              Code:
              dim tbl as P
              dim tbl2 as P
              dim otherValue as C
              dim masterList as C
              dim oldList as C
              
              masterList = <<%txt%
              aekvn
              aizev
              anmcp
              fpory
              hsxaf
              irbxc
              ntqyx
              utwlf
              vtohe
              zfvxx
              %txt%
              
              oldList = <<%txt%
              ewwbg
              svasp
              gfudn
              lkode
              ivdwb
              zjwga
              dxcdk
              xwitc
              ublgu
              whwdg
              ntqyx
              hsxaf
              %txt%
              debug(1)
              
              tbl = table.open("masterDBF",FILE_RW_SHARED)
              'tbl.enter_begin()
              for each id in masterList
                  tbl.enter_begin()
                      tbl.ref = id.value    
                  tbl.enter_end(.t.)    
              next 'id
              tbl.close()    
              tbl.open("olddbf",FILE_RW_SHARED)
              for each id in oldList
                  tbl.enter_begin()
                      tbl.ref = id.value
                  tbl.enter_end(.t.)
              next 'id
              tbl.close()        
              tbl2 = table.open("masterdbf")
              
              
              'PleaseWait(.T.)
              
              tbl2.fetch_first()
              while .not. tbl2.eof()
              if tbl2.eof() then
                  debug(1)
              end if
              tbl2.change_begin()
              otherValue = LOOKUPC("F",tbl2.ref,"ref","olddbf","ref")
              tbl2.dup = if(otherValue = tbl2.ref,"T","F")
              tbl2.change_end(.t.)
              tbl2.fetch_next()
              
              end while
              if tbl2.eof() then
              tbl2.change_begin()
              otherValue = LOOKUPC("F",tbl2.ref,"ref","olddbf","ref")
              tbl2.dup = if(otherValue = tbl2.ref,"T","F")
              tbl2.change_end(.t.)    
              end if
              tbl2.close()
              debug(1)​
              Gregg
              https://paiza.io is a great site to test and share sql code

              Comment


                #22
                Ho Hum!
                Well I was proven right. Dinner gone and a field in the primary table has been set up to identify duplicates in the secondary table.
                The checking is done in a SET and that can be a bit daunting, so please see the attached and pull it apart to see how it works.
                There is also a dupe check which runs the Intersect operation as an example.

                It seems a bit easier to upload what I meant rather than all this coding stuff!

                Pick a Form and view if you so wish.

                Dupes Validation Example.zip
                See our Hybrid Option here;
                https://hybridapps.example-software.com/


                Apologies to anyone I haven't managed to upset yet.
                You are held in a queue and I will get to you soon.

                Comment


                  #23
                  You know I think Ted wins the prize with the Intersect. I just need to change my order of when I actually do the Intersect for it to work. Thanks to all for all your work on this and I want you all to know I sincerely appreciate the effort and the push in the right direction for me.

                  Take care all and Happy Thanksgiving!

                  Scott

                  Comment


                    #24
                    Glad you have a solution that fits your situation.
                    Remember you can also use the SUBTRACT operation to create a table of records from the Master table which Do Not have a corresponding duplicate data field in the subsidiary table.
                    See our Hybrid Option here;
                    https://hybridapps.example-software.com/


                    Apologies to anyone I haven't managed to upset yet.
                    You are held in a queue and I will get to you soon.

                    Comment


                      #25
                      Scott,
                      Glad you got this underway.
                      You wrote: "And just so you guys know there are a lot of records in the one table, probably around 35,000 or so.......".
                      Just for the record, which table has the 35K records?
                      Which table has the 35K records....The source table (tbl2=dup_check)​ or the target table ( tbl =ameregl3 )? Is the other table smaller and how many records are in the table that doesn't have 35K records?
                      To have it be said, there is no reason that the loop that is checking for a record field value match between two tables needs to happen with the big table being the source table checking against a table with less records. With the goal of finding matching ref values in the two tables, the execution is most effectively executed using a source table loop and target table filter method by having the source table being the smaller of the two tables.

                      @madtowng:
                      You wrote: "What's missing is that garage_2 has a list of items in order of the ref number. Once the ref number is found, the door is closed, and move to the next item."
                      I'm not sure from where the info that the ameregl3 table records exist in reg value order. However that makes no difference because the lookupc() and the tbl.order() function filter the target table (ameregl3) to the source table (dup-check) ref value. There is no loop through the ameregl3 table, so your statement that "each item is checked" I believe is invalid. And the whole point of my example is that ...yes... the garage door of the target table (amereregl3 = Garage_2) is opened and closed with each iteration through the source table (dup_check - Garage 1) by using the lookupc() function within each loop iteration of the source table, and that is the burden difference in the methods I was trying to reveal.

                      And if you can use operation as Ted is recommending... that's your ticket to paradise!
                      Mike W
                      __________________________
                      "I rebel in at least small things to express to the world that I have not completely surrendered"

                      Comment


                        #26
                        I have automatic garage doors, so I'm OK with that.
                        The zip has an example of the Intersect operation, as well as loony Set stuff with a calculated field to auto set for dupes, Mike.

                        As Arthur Dailey said " the world's your lobster!"
                        See our Hybrid Option here;
                        https://hybridapps.example-software.com/


                        Apologies to anyone I haven't managed to upset yet.
                        You are held in a queue and I will get to you soon.

                        Comment


                          #27
                          Originally posted by Mike Wilson View Post

                          Al, I can see that the sets you describe can show linkages, but I'm not immediately coming up with how the logical field value for dup is updated in the parent table with a conditional value based upon a link existing or not.
                          An operation - probably an update for the set.

                          Then you can see the results in a browse for the set.
                          Al Buchholz
                          Bookwood Systems, LTD
                          Weekly QReportBuilder Webinars Thursday 1 pm CST

                          Occam's Razor - KISS
                          Normalize till it hurts - De-normalize till it works.
                          Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                          When we triage a problem it is much easier to read sample systems than to read a mind.
                          "Make it as simple as possible, but not simpler."
                          Albert Einstein

                          http://www.iadn.com/images/media/iadn_member.png

                          Comment


                            #28
                            I forgot to mention that the Parent can be updated initially by running Reevaluate Field Rules in the little .zip I posted.
                            After that, if you add a record to the parent, which has a corresponding recording the child, the flag will be set to True.
                            See our Hybrid Option here;
                            https://hybridapps.example-software.com/


                            Apologies to anyone I haven't managed to upset yet.
                            You are held in a queue and I will get to you soon.

                            Comment


                              #29
                              might be a good idea to create an index on the field your searching too
                              NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

                              Comment

                              Working...
                              X