Cant answer your specific question re the "expression_list" portion of a select. Considering the number of other places within SQL statements functions can be used, might be an oversight. Computed fields display and update correctly if based on native functions. (select Left$(cola,5) from ...). Replacing the native function with your own same-named version doesnt help.
In other places, a statement such as: Add column tabA (col1) from tabA set to cust_funct(args) where .... builds a correct result and responds to data changes as long as the program is still running. Possibly because the derived column needs special treatment, it is supported here ONCE but not as a Select computed column. I have used custom functions within spatialSQL (updated version 1.21 now available) and have put a summary here: (http://www.acenet.com.au/~pwaight/spatialsql_custfns.htm) of some of the things I have learned. The page also has test program source for download. Once wiki is going, a topic covering this would be useful as the scope of this hasnt been fully covered in anything I've seen. Phil. ----- Original Message ----- From: "Bill Thoen" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, July 11, 2004 2:01 AM Subject: MI-L Updating fields with functions > Updating table fields with functions is a much faster techique than > stepping through a table record by record to change a field. I was curious > to see how far the technique could be stretched and discovered that using > a function in a select doesn't seem to work, but in an update, it works > fine. Why is this? Anyone know? > > Here's a test program illustrating the problem: > > Declare Sub Main > Declare Function Reverse (ByVal sName As String) As String > > Sub Main > Dim sFile As String > ' Open the States table and build a new table using STATES.State_Name > ' passed to a function that returns a string. The string returned from > ' that function will be used to populate a temporary table and a > ' permanent one. Why does the temporary table not get filled, while > ' rows are created? > > ' Set up and open the source table > Close All > sFile = FileOpenDlg ("", "States.Tab", "TAB", > "Please open the STATES table") > If sFile = "" Then > Exit Sub > End If > Open Table sFile As STATES > > ' This works only rarely (but sometimes it does!) > ' Usually all rows are blank. > Select Reverse (State_Name) "emaN_etatS" > From STATES Into TEMP NoSelect > > ' This does work > Create Table PERM ( > emaN Char(20) > ) > Insert Into PERM Select Reverse (State_Name) From STATES > Commit Table PERM > > ' View the results > Browse * From PERM > Browse * From TEMP > End Sub > > > Function Reverse ( > ByVal sName As String) ' Input string > As String ' Returned word spelled backwards > 'Reverses letters in a string > Dim sRevWord As String > Dim i, j As Integer > > j = Len(sName) > For i = j To 1 Step -1 > sRevWord = sRevWord + Mid$(sName, i, 1) > Next > > Reverse = sRevWord > End Function > > > --- > - Bill Thoen > > > > --------------------------------------------------------------------- > List hosting provided by Directions Magazine | www.directionsmag.com | > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > Message number: 12542 >
