Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

free form syntax for %lookup

Status
Not open for further replies.

thelearner

Programmer
Jan 10, 2004
153
US
Hi everyone,

Can anyone show me a free form syntax for %lookup to search the array.

Thanks.
 
%LOOKUP(value:array)

___________________________________________________________________
onpnt2.gif

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
 
O' also you can specify the starting point with a third parm

eg:
%LOOKUP(value:array:index)



___________________________________________________________________
onpnt2.gif

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
 
Hi,

1. How do I check if I find my value in the array, ie do I use %found?
2. How do I know which array element is it in? Should I put the index inside the syntax too, like
%LOOKUP(value:array(idx):index) ???

Thanks
 
1. How do I check if I find my value in the array, ie do I use %found?


you can use condtiioning to check to see if you've found a match

If %LOOKUP(value:array) > 0
..


2. How do I know which array element is it in? Should I put the index inside the syntax too, like
%LOOKUP(value:array(idx):index)


in this case above I assume idx is your increment or counter. that being the value should be your index to start at.

so %LOOKUP(value:array:idx)

if the value of idx is 3 and array(3) contains a match then it passes. you know the array element the match was found in because that is what is returned
eg:
value = "test"
array(2) = "test"

If %LOOKUP(value:array) > 0
myValue = array(%LOOKUP(value:array))


that being shown in the most broad sense for a example.

I have not used the index positioning parm as of yet. jsut haven't found a need for it. I can see it's gain in efficiency on not needing extra declarations and such though

___________________________________________________________________
onpnt2.gif

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top