Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FPD25 SELECT and UDF and Multiple DBFs
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00593262
Message ID:
00594758
Views:
43
Hi Sergey

I got your point, in fact I had done a similar query before and the list of params was so long that it was hell maintaing.

Now what I have done is I have removed from the SELECT the DBFs to be used in the calculation, they were previously joined only becuase I wanted to pass its fields as parameters to my UDF.

Now there is no such DBF in the SQL, they are now regular DBF opened in other work areas with index and all. In my UDF I receive only one parameters the PK, this PK is the one I would have used to join the discussed DBFs, now that they are standalone, in my UDF all I do is regular SEEK() to these just disconnected DBFs and I get the same results. Efficiency I not sure of yet but the SQL is a lot better managed with all the FPD25 limitations.


>You missed my point. You cannot reference already open tables used in SQL Select because SQL Select isn't using them.
>
>>I was aware of parameter passing but I had too many parameters and only the calulated result was required. So I took it differently, removed the DBFs which were only for parameter purposes, passed the PK to the UDF, the UDF did regular SEEK() of the just disconnected DBFs now regular used files, calc the retval and best of both the worlds are here.
>>
>>Thanks for responding
>>
>>>>>>Dear All,
>>>>>>
>>>>>>I am writing a SELECT statement. I have to use multiple UDFs in it as there are a lot of complicated calcuations going on in it and the return value from the UDF is to be used as the value for the SELECT.
>>>>>>
>>>>>>1) Should I, WHERE join the required DBFs and in the UDF straight away use the current record in the respective DBFs for calculations?
>>>>>

>>>>>
>>>>>I would try this first.
>>>>
>>>>No Go. The record pointer is not where it should be for the record being joined in the DBFs
>>>>
>>>
>>>The SQL Select doesn't uses already open tables but works with there copies opened with equialent of USE AGAIN comand. That's why you cannot use table aliases in such function as RECNO(). The same applays to UDF, you have to pass all fields you need from tables involved in Selecxt as parameters to UDF.
Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
___________________________________________
venussoftop@gmail.com
___________________________________________
Previous
Reply
Map
View

Click here to load this message in the networking platform