Alpha Video Training
Results 1 to 16 of 16

Thread: Multi Column Dynamic Lookup

  1. #1
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,956

    Default Multi Column Dynamic Lookup

    Here is a revised edition for V8 - it uses a modified version of Alpha Sports
    to use it - open it, goto Customers, and use the DemoLookup button

    the FTP is only good for 14 days, so if you see this after 4/27/2007+14 email me at martin_w_cole@msn.com and I'll email it to you.

    it uses form CustomerLookup - note there is a shared form vaiable called bcol (browse current column) and that at the browses onarrive event, it sets the variable to the browses current column - and when changing columns it resets the variable.

    all the action is in the form's onkey event. If you type "W" and then "I" in the Customer column, and then use for example the tab or right arrow key to change columns, it resets the query.

    the salient feature is that it searches within the current field, not from left to right. It is especially helpful when looking up in fields where the values are cryptic - like in a partnumber field where the value was "R7-A24769b-Lugs-Boeing" and you had 5 parts that contained "Lugs" and 7 that contained "Boeing" - you could quickly find by searching for "lugs", scrolling, and Enter of DoubleClick. It works as is quite well where there are up to about 12 to 14 thousand records. For larger files, I set it to start looking on the 2nd or 3rd character entered.

    http://www.yousendit.com/download/WUJiTkFuTmFxRTAwTVE9PQ
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

  2. #2
    Member
    Real Name
    ken doucet
    Join Date
    Oct 2005
    Location
    Hamilton, Ontario
    Posts
    195

    Default Re: Multi Column Dynamic Lookup

    Thanks for posting this, I just tried it out and it just brings the search to new levels. This should really be embedded in the AlphaSports application as it makes the searching process a joy. As long as you know some portion of the field value you can find it and don't have to use wildcards in the search.

    Ken

  3. #3
    "Certified" Alphaholic
    Real Name
    Mike Christensen
    Join Date
    Nov 2005
    Location
    Michigan U.P.
    Posts
    5,937

    Default Re: Multi Column Dynamic Lookup

    Martin,

    Does this edition also work for prior versions of Alpha and if so which as far as you know??
    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
    __________________________________________




  4. #4
    VAR
    Real Name
    Martin W. Cole
    Join Date
    Apr 2000
    Location
    Terrell, Texas (near Dallas)
    Posts
    5,956

    Default Re: Multi Column Dynamic Lookup

    it should work in any version from 5-4.0 thru 8
    I've been usig it for several years - the orginal idea was from Dr. Peter Wayne - I just modified and enhanced for my own use. All my users like it, especially vecause I have a lot of cryptic fields in a lot of apps

    be sure that the column title matches

    say you change the column title to "Billing Addess"
    elseif browse1.active()="bill_address_1"
    query.filter="var->tempstr $ bill_address_1"

    browse1.active() is now "Billing Address"
    but the filter remains, as it address a field name, not a column title
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    martin_w_cole@msn.com

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

  5. #5
    Member
    Real Name
    Aundrea
    Join Date
    Aug 2007
    Posts
    8

    Default Re: Multi Column Dynamic Lookup

    I just saw your post regarding the multi column dynamic lookup. I was wondering if you could send me a copy of the sample you posted. It sounds like the answer I have been looking for! I need to be able to lookup differing amounts OF various items in rows by columns depending on column header typed into textbox.

    ex:

    A B C
    CAT 11 22 33
    DOG 44 55 66
    MOUSE 77 88 99


    If items in 2 search boxes are "DOG" AND "B" RESPECTIVELY, THIRD TEXT BOX DELIVERS RESULT OF "55"

    Do you think your method would work for that? ANY suggestions would be greatly appreciated; I am pulling my hair out!

    Thanks
    Marie

  6. #6
    Volunteer Moderator
    Real Name
    Alan Buchholz
    Join Date
    Oct 2000
    Location
    Delavan, Wisconsin
    Posts
    9,626

    Default Re: Multi Column Dynamic Lookup

    Marie

    I think you should look at the conditional table lookup. It's the next choice after table lookup.....

    ps - don't pull your hair out. Most of us have already done that.. ;)
    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.

  7. #7
    Member
    Real Name
    Aundrea
    Join Date
    Aug 2007
    Posts
    8

    Default Re: Multi Column Dynamic Lookup

    Thanks! I will give it a shot!

  8. #8
    Member
    Real Name
    Aundrea
    Join Date
    Aug 2007
    Posts
    8

    Default Re: Multi Column Dynamic Lookup

    Having problems still. I guess it wasn't what I need. My problem requires a more detailed lookup.
    I am still trying to find help with a look up function.

    I want my staff to be able to input a variable into 2 input boxes (such as "Animal" and "Internal code"),

    with a third box producing the result of a cross reference lookup. The column searched is dependant on the Animal and Internal code submitted.

    Example: database columns = A,B,C and rows = CAT, DOG AND MOUSE (real database contains thousands of records so drop down boxes are not an option). Excel made this easy by allowing rows and columns to have range names making it easy to find the intersection. Not sure how to accomplish this in Alpha.

    ------------A-- B---C
    CAT-------11--22--33
    DOG-------44--55--66
    MOUSE----77--88--99

    Data input:
    Animal: Dog Internal code: B

    Data output =55
    Items in 2 search boxes are "DOG" AND "B" RESPECTIVELY, THIRD TEXT BOX DELIVERS RESULT OF "55". Column "B" and Row "Dog" interersect in cell with content of "55"

    Anyone else have any ideas?

    Thanks
    Marie

  9. #9
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,200

    Default Re: Multi Column Dynamic Lookup

    Marie,
    Do you already have this spreadsheet. If so, it could be converted into a three field table with 3 fields animal, 'column', code. How many animal? How many columns (A,B,C,etc) ? I will help you.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  10. #10
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,200

    Default Re: Multi Column Dynamic Lookup

    Marie,
    Here is an example.

    I created a spreadsheet with columns as Animals and A-H, and made code numbers in the cells as you described. I saved this as a .dbf IV file = xls_codes. I then added this table to the database. It has the 9 fields of Animals, and A-H (columns). I created another table named = Codes with three fields = Animal, Column, and A_code. I then wrote a script (transform) to convert the data in the xls_code table to fit into the fields and structure of the Codes table. The codes table can now be your lookup table based upon the two field values of animal and column. The form F_dataentry has an OnDepart script on the Column field with the lookup to the Codes table based upon the values in the Animal and Column fields and fills in the code into the A_code field.

    I think this is what you were looking for. Hope this helps, and good luck.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  11. #11
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Multi Column Dynamic Lookup

    You should be able to do this with a lookup() expression and return it to a calculated field for the form (third text box).

    Suppose

    the leftmost field in the lookup table where you have cat, mouse, dog has the field name "animal"
    the object name of the first text box is "which"
    the object name of the second text box is "where"

    lookup("yourtablename","animal = "+quote(which.value),where.value)

  12. #12
    Member
    Real Name
    Aundrea
    Join Date
    Aug 2007
    Posts
    8

    Default Re: Multi Column Dynamic Lookup

    Thanks so much everyone for the help. I will try the suggestions this weekend. Oh, and my spreadsheet has 11076 rows and 410 columns. Data maintenance is a nightmare so being able to look up info is a must!

    Thanks again!
    Marie

  13. #13
    "Certified" Alphaholic Mike Wilson's Avatar
    Real Name
    mike wilson
    Join Date
    Apr 2005
    Location
    Grand Rapids, Michigan
    Posts
    4,200

    Default Re: Multi Column Dynamic Lookup

    Quote Originally Posted by Stan Mathews View Post
    You should be able to do this with a lookup() expression and return it to a calculated field for the form (third text box).

    Suppose

    the leftmost field in the lookup table where you have cat, mouse, dog has the field name "animal"
    the object name of the first text box is "which"
    the object name of the second text box is "where"

    lookup("yourtablename","animal = "+quote(which.value),where.value)
    Heck, Stan..what's the fun in doing it the easy and direct way. 11076 * 410 would be 4,541,160 records. Whoa... never mind.

    Code:
    dim vpet as C = "Ant"
    dim vcol as C = "D"
    ? lookup("xls_codes","animal = "+quote(vpet),vcol) 
    = 4007
    ps: sorry to misbehave by further hijacking m.c's thread.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

  14. #14
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: Multi Column Dynamic Lookup

    Quote Originally Posted by Mike Wilson View Post
    Heck, Stan..what's the fun in doing it the easy and direct way. 11076 * 410 would be 4,541,160 records. Whoa... never mind.

    Code:
    dim vpet as C = "Ant"
    dim vcol as C = "D"
    ? lookup("xls_codes","animal = "+quote(vpet),vcol) 
    = 4007
    ps: sorry to misbehave by further hijacking m.c's thread.
    Mike,

    I'm just stumbling around in the dark and learning by experimenting. I had no idea that one could construct a double variable driven lookup. I suppose it could actually be a triple variable driven lookup if one was offered the choice of tables on which to perform the lookup.


    My original thought was to use the "column" horizontal position translated into a field number which would get you to the field name but soon realized that was unnecessary. This sort of thread is just so much darn fun.

  15. #15
    Member
    Real Name
    Aundrea
    Join Date
    Aug 2007
    Posts
    8

    Default Re: Multi Column Dynamic Lookup

    Thanks Everyone! That makes much more sense and I think we have a winner! I think it will work like a charm!

    Marie

  16. #16
    Member
    Real Name
    Julie Alley
    Join Date
    Apr 2008
    Location
    Seattle, WA
    Posts
    89

    Default Re: Multi Column Dynamic Lookup

    I will be adding this to our searching ability within the alphastore - this is very nice enhancement for searching.

    Would you please send me a copy.

    Thank you for your time.

Similar Threads

  1. Multi-Column Dynamic Search
    By martinwcole in forum Code Archive
    Replies: 5
    Last Post: 03-23-2007, 08:36 AM
  2. Sets and multi-column keys
    By gcaplan in forum Alpha Five Version 6
    Replies: 7
    Last Post: 07-11-2005, 11:16 AM
  3. Sorting multi-column report
    By brett s in forum Alpha Five Version 5
    Replies: 2
    Last Post: 07-10-2005, 04:16 PM
  4. Multi-Column Keys
    By Lawrence Fox in forum Alpha Five Version 5
    Replies: 3
    Last Post: 06-17-2003, 07:41 AM
  5. multi column report
    By Jeremy Packman in forum Alpha Five Version 4
    Replies: 2
    Last Post: 06-07-2000, 08:03 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •