Sign in to follow this  
Followers 0
Jim1976

Table Lookup

3 posts in this topic

I have limited experience with AutoIt, and fairly new at programming but I'm trying to use AutoIt to return a value from a lookup table. This would be similar to the VLOOKUP function from Excel.

I've tried working with a table in Access and using and Access.au3 UDF I found in the forum, but I can't seem to get it to work.

I can provide a table (.dbf, .mdb, .txt) with my lookup value and my return value in separate field in the same record. I just need to return the data from the second field after looking up the match value from the first field.

Ex:

Cats Dogs

Potato Tomato

Fish Bird

Left Right

Yin Yang

If the lookup value is "Fish", I want to the value "Bird" returned.

Any suggestions?

Share this post


Link to post
Share on other sites



Try:

#include <Array.au3>
Local $arr[6][2] = [["Cats", "Dogs"],["Potato", "Tomato"],["Fish", "Bird"],["Left", "Right"],["Yin", "Yang"],["Black", "White"]]
_ArrayDisplay($arr)
$Key = InputBox("Choose:", "Type your Lookup key in here!", "Fish")
For $x = 0 To UBound($arr, 1) - 1
    If $arr[$x][0] = $Key Then
        MsgBox(0, $Key, "Equal = " & $arr[$x][1])
        Exit
    EndIf
Next
MsgBox(0, 'Sorry!', 'Nothing found!', 2)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0