>I want use a UDF to create a new variable in a SQL select statement to crate a cursor for a
> report. The UDF would also be used to update a table using SCAN/ENDSCAN latter on.
>Calculation depends on 4 fields. I tried something like
>
> SELECT a,b,c,d,e,f,udf() as name from table
>
>to test it. Only one value is return (one calculated for first record). Do I have to pass
>all the fields to the UDF and use local variables? Did look at documentation, It is not
>clear on how to do this.
>
>TIA.
Claude,
You probably do.
SQL Select open the tables specified in the FROM clause again in new workareas under new aliases. It does this to have free rein in determining what indexes should be used. There is also the benefit that it doesn't move the record pointer in the original alias.
If you are using the original alias in your UDF then that is the problem. Pass in the field values and use those parameters to determine a return a value.
HTH.
Larry Miller
MCSD
LWMiller3@verizon.netAccumulate learning by study, understand what you learn by questioning. -- Mingjiao