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

Copy database using cross level query, child table values found in parent memo field

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

  • Copy database using cross level query, child table values found in parent memo field

    This puzzle is a good one, but my solution is not working. Any help would be very much appreciated!!

    I have two tables.

    1 = product information table with product description MEMO fields: 4000 rows
    2 = a keyword lookup table with keyword CHAR field:500 rows

    The need is to

    Find the occurance of ANY of the 500 keywords in the product information description memo field.
    Then, copy the unique ID from both tables to a third table, creating a reference link between the two tables.

    I tackled the problem this way.
    I made a one to many SET out of both tables, parent table was the product table. I made a linking id field in both tables, filled all rows in both tables with "1". This means every product record is linked to every keyword record.

    this way I can run a CROSS LEVEL query that looks like this

    containsi(product_parent_table->prod_desc_memo,keywork_child_table->keyword_char)



    Sample Data

    Parent product table
    Prod_ID Prod Description MEMO
    111 red toy wagon with black wheels
    222 red toy wagon with white wheels
    333 red toy wagon with silver wheels

    Child keyword table
    Keywd_ID Keyword CHAR
    aaa red
    bbb black
    ccc white

    DESIRED OUTPUT

    Prod_ID Keywd_ID
    111 aaa
    111 bbb
    222 aaa
    222 ccc
    333 aaa
    Logical Design
    Keven Thibeault
    Boston, Massachusetts
    Dwell in possibility

  • #2
    Re: Copy database using cross level query, child table values found in parent memo fi

    by the way - I was also thinking I could write an xbasic code that would step through the keyword database one by one and somehow copy records out to a third resuld table. this would seem very slow I imagine.

    A lot of views on this topic, any ideas anyone??

    thanks a million
    Logical Design
    Keven Thibeault
    Boston, Massachusetts
    Dwell in possibility

    Comment


    • #3
      Re: Copy database using cross level query, child table values found in parent memo fi

      Originally posted by kthibeault1965 View Post
      by the way - I was also thinking I could write an xbasic code that would step through the keyword database one by one and somehow copy records out to a third resuld table. this would seem very slow I imagine.

      A lot of views on this topic, any ideas anyone??

      thanks a million
      Personally I would go with the scripted method as you suggest. I was going to suggest it but you beat me to it.

      The script would
      • open the three tables you want to work with.
      • loop through the keyword table
      • within the keyword loop loop through the product table checking the memo field for the current keyword
      • if a match then write a record to your third table.
      • Close three tables
      Checkout the batch_begin() and batch_end() functions to optimise the loops.

      I think it might be quicker than you think the record count you are talking about is not all that high.

      Have a go at the script and if you get stuck, holler. Some one will come to your aid. If/when you do holler include what you have tried, either the script or a sample database.

      Good luck.
      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


      • #4
        Re: Copy database using cross level query, child table values found in parent memo fi

        Tim

        thanks for your thoughtful reply, I will upload a zip file of what I come up with.

        btw, I was in Melbourne for 4 months last "summer", your summer, best of luck with the terrible drought! I was consulting to Telstra, my best friend is a marketing consultant who lives in M.

        cheers
        Logical Design
        Keven Thibeault
        Boston, Massachusetts
        Dwell in possibility

        Comment


        • #5
          Re: Copy database using cross level query, child table values found in parent memo fi

          I have attached a small sample db to illustrate what I am talking about.

          the approach I have built today does work for small dbs, not for my size of 4000 parents and 2000 child records unfortunately.
          Logical Design
          Keven Thibeault
          Boston, Massachusetts
          Dwell in possibility

          Comment


          • #6
            Re: Copy database using cross level query, child table values found in parent memo fi

            Originally posted by kthibeault1965 View Post
            Tim

            thanks for your thoughtful reply, I will upload a zip file of what I come up with.

            btw, I was in Melbourne for 4 months last "summer", your summer, best of luck with the terrible drought! I was consulting to Telstra, my best friend is a marketing consultant who lives in M.

            cheers
            Your welcome.

            We have had a bit of rain locally. Just enough to make the grass green and fill the water storages a little bit. However we are still on stage 4 water restrictions and inland Ie where our fruit comes from they're still doing it tough. Many farmers are pruning their trees with a bulldozer.:(
            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: Copy database using cross level query, child table values found in parent memo fi

              Kevin,
              Attached is your sample with the script Tim was describing. I had one for this already in my code library. I encourage you to work on this first and then look at the script keyword_probe, since you stated is was a good exercise, and is, and a good learning tool. The one hint I can give you that is not intuitive.... when you capture the keyword from the productkeyword table into a variable, you need to alltrim(), or trim() it for your query to the memo field in the productdescription table. I can't tell you how many times my query filters have failed ( and the frustration level skyrockets) because of this small and easily overlooked need.

              Also, the documentation for batch_begin() will not come up under index search. You have to go to 'tables', and scroll down to 'batch'

              Good luck.

              Tim, Bulldozers... Arg! Hope you guys are OK
              Mike W
              __________________________
              "I rebel in at least small things to express to the world that I have not completely surrendered"

              Comment


              • #8
                Re: Copy database using cross level query, child table values found in parent memo fi

                thanks MIKE !!

                speaking of frustration, when the key word is actually two words: "RED HAT", do you know how I get the query to ignore records with the descriptoin" RED BOOTS and BLACK HAT" in the search string? this is giving false positives.

                and thanks again for your code.. i really really appreciate the help-

                Keven Thibeault
                Logical Design
                Keven Thibeault
                Boston, Massachusetts
                Dwell in possibility

                Comment


                • #9
                  Re: Copy database using cross level query, child table values found in parent memo fi

                  Hi Kevin


                  i have done something like what you are
                  thinking but approached it a little differently

                  i needed to be able to search a product table(flower arrangements) for
                  1) a particular flower and/ or for a particular color
                  2) these text descriptions could be in any of 4 fields in the product table


                  i created queries for each individually - and saved the results to 2 tables
                  serachcolors and serachflowers then to use this data as the basis
                  of a search tool for the web i created a web component based on a VIEW of

                  products
                  -serachcolors
                  -serachflowers

                  link field productID

                  the results are here

                  http://www.jollygreenthumb.com/search.a5w

                  not elegant but it works for me and i only have a handful of flowers and colors
                  to search for

                  hth
                  regards

                  martin
                  www.jollygreenthumb.com

                  Comment


                  • #10
                    Re: Copy database using cross level query, child table values found in parent memo fi

                    Originally posted by kthibeault1965 View Post
                    thanks MIKE !!

                    speaking of frustration, when the key word is actually two words: "RED HAT", do you know how I get the query to ignore records with the descriptoin" RED BOOTS and BLACK HAT" in the search string? this is giving false positives.

                    and thanks again for your code.. i really really appreciate the help-
                    Kevin,
                    Look into remspecial(). This strips out things so Van Buren = VanBuren, and O'conner = Oconner.
                    Mike W
                    __________________________
                    "I rebel in at least small things to express to the world that I have not completely surrendered"

                    Comment


                    • #11
                      Re: Copy database using cross level query, child table values found in parent memo fi

                      Mike thanks - I actually need the space in this case.

                      "Not tested on animals" needs to be found in that form in the search field. removing the spaces would not work in that case.
                      Logical Design
                      Keven Thibeault
                      Boston, Massachusetts
                      Dwell in possibility

                      Comment


                      • #12
                        Re: Copy database using cross level query, child table values found in parent memo fi

                        keven,
                        I am afraid your going to have to be a little more specific about what the problem with "Red Hat" and "Black Hat" is. Is it those specific words or descriptions with those or some specific words, or that there is more than a single word in the filter, or what? As specific as you can be.
                        Mike W
                        __________________________
                        "I rebel in at least small things to express to the world that I have not completely surrendered"

                        Comment

                        Working...
                        X