What is your index expression? You should build it as non-structural index (idx). It's really not a good idea to have UDF in index expression, especially involving another table. View would be much better solution, I agree with Michel.
>A view won't work as I have 3 related tables, with 2 of the related tables relating directly to the parent table.
>
>I don't understand why my index based on a UDF isn't working. Any ideas. This is the code for one of the stored procedure UDFs:
>
>FUNCTION getcompname
>PARAMETERS xcCompanyID
>PRIVATE lcCurAlias, lcCompanyID, lcCompany
>
>lcCurAlias = ALIAS()
>lcCompanyID = ALLTRIM(xcCompanyID)
>lcCompany = " "
>IF !EMPTY(lcCompanyID)
> IF !USED("FindCompany")
> USE Company IN 0 AGAIN ALIAS FindCompany
> ENDIF
> IF SEEK(lcCompanyID, "FindCompany", "Company")
> lcCompany = FindCompany.Name
> ENDIF
>ENDIF
>IF USED("FindCompany")
> USE IN FindCompany
>ENDIF
>
>SELECT (lcCurAlias)
>RETURN lcCompany
If it's not broken, fix it until it is.
My Blog