Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Memo in Select statements
Message
 
To
07/02/2008 14:28:20
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01290540
Message ID:
01290601
Views:
26
This message has been marked as a message which has helped to the initial question of the thread.
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform