Information générale
Catégorie:
Codage, syntaxe et commandes
>I have a strange thing happening and can't find any good documentation on calling UDF's from a SQL statement.
>
>when I execute this SQL (Abridged) the functions are returning the correct string values, yet the cursor shows only the first instance of a letter.
>
>SELECT convertCType(c.cardtypes)AS ctypes, ;
> convertTtype(c.transtype) AS ttypes, ;
> cardtypes,transtype;
> FROM changes AS c
>
>
>FUNC convertTtype(ttype)
>*set step on
>ret = ""
>IF BITAND(1,ttype) # 0
> ret = ret + "S"
>ENDIF
>
>IF BITAND(2,ttype)# 0
> ret = ret + " Cr"
>ENDIF
>RETURN ret
>ENDF
>
>I always get either "S" in the column or if a 2 value it shows blank. I KNOW that the function returns the proper value. Also, how can I make an SQL column more than 6 characters long. It will cut off extra letters if I put for instance "A very large sale" as a return value. It seems that VFP is not as ANSI '92 compatible as MS would lead you to believe.
Ensure that your functions return the maximum expected string size each time. Use the space() function to pad them with blanks.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement