Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Looking up values in an array
Message
From
28/08/2001 17:41:01
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00550067
Message ID:
00550079
Views:
17
>I have a variable (called bd) that contains a date put in by a user. I also have an array that has list of dates retrieved from a table. I am looking for a date that the user entered against the array that fetched the dates from a table. The date that I am trying to retreive from array has to be either >= user inputted date. What is the fastest way to search for a date in an array that can be greater than or equal to value user input
>
>&&user inputted date
>bd=.t1.value
>
>&& dates from table
>SELECT DISTINCT (bdate) FROM payroll!payroll_tbl into array a__gen1
>
>I tried the ascan but I don't think it supports >= expressions.
>
>Thanks
>Nick Patel

There's no other function to search for a value in an array, you're probably going to have to order the array and then compare all the values one by one.

Either ASORT() or adding ORDER BY to your select would give you an ordered array that you can work with for this.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform