Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Memo in Select statements
Message
De
07/02/2008 16:36:15
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Divers
Thread ID:
01290540
Message ID:
01290603
Vues:
17
Hi Bo,

Wow, thanks for that info. I will keep that in mind for my vfp6 projects coming up into vfp 8.
But I got mad and moved my project over to my vfp 9 machine and did the cast. This is just suppose to be a quick conversion project, until I hit this memo problem.

Beth

>Beth,
>
>As Sergey said, this is easily handled in VFP9 with the CAST function. The other suggestions of including a dummy memo filed in your SELECT and then REPLACE afterwards is a fair solution also...
>
>But I thought I would mention this trick I figured out back in the VFP5 days (and it even works with earlier versions of Fox), you may want to consider it also; You can create a dummy function that returns a memo and call the function from your SELECT, this will force a memo field for any character expression you want to pass in.
>
>Here is an example. Note that the dummy cursor gets created the first time the function is called. Then you must call the function, after your SELECT statement to close up the dummy cursor. Notice the FORCEMEMO function call that was added to your "nxtact_not" field in the SELECT:
>
>
>SELECT TYPE, calldate AS act_time, lcPrblem AS problem_id, ;
>  "OLDFLTDB" AS user_id, lcclient AS client_id, ;
>  ALLTRIM(contacttype) + " - " + ;
>  TEXT AS act_notes, ;  && <------- this is a memo field
>  ForceMemo("Number: " + ALLTRIM(STR(NUMBER)) ;
>  + "  ID: " + ALLTRIM(STR(ID))) AS nxtact_not, ;  && <-- this is a memo field
>  TTOD(calldate) AS act_date ;
>  FROM ctempaction LEFT JOIN cactiontype ;
>  ON ctempaction.TYPE = cactiontype.contacttypeid ;
>  WHERE NUMBER = lnnumber ;
>  AND !EMPTY(TEXT) ;
>  INTO CURSOR csupaction READWRITE nofilter
>
>ForceMemo("",-1) && Close temporary memo cursor
>
>***************************************
>FUNCTION ForceMemo(tcExpr, teKill)
>  LOCAL lnSelect
>
>  IF PCOUNT() > 1
>    ** close the memo cursor
>    USE IN SELECT("__forcememo")
>    RETURN
>  ENDIF
>
>  IF NOT USED("__forcememo")
>    ** memo cursor is not created, create it now
>    lnSelect = SELECT()
>    SELECT 0
>    CREATE CURSOR __forcememo (foo m)
>    APPEND BLANK
>    SELECT (lnSelect)
>  ENDIF
>
>  ** Stuff value into memo field
>  REPLACE __forcememo.foo WITH tcExpr
>  ** Return memo field
>  RETURN __forcememo.foo
>ENDFUNC
>
>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform