Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SUBSTR of a Memo field returns a Memo field?!
Message
De
06/07/2005 10:33:23
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
06/07/2005 09:54:51
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7 SP1
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Divers
Thread ID:
01029401
Message ID:
01029465
Vues:
16
This message has been marked as the solution to the initial question of the thread.
PMFJI
Transform() or substr(string,N,M)+'' might cause to lose data.
Use something else as Hilmar and Fabio said (Left() or Padr()). ie:
LOCAL lnPieces,lnLen,ix
lnPieces = 10
lnLen = 250
Set Textmerge To Memvar m.lcScript Noshow
Set Textmerge On
\\select
For ix=1 To 10
\\ LEFT(SUBSTR(notes,<<(m.ix-1)*m.lnLen+1>>,<<m.lnLen>>),<<m.lnLen>>) as Piece<<PADL(m.ix,2,'0')>>
  If m.ix<m.lnPieces
\\,
  Endif
ENDFOR
\\ from Employee into cursor crsSliced
Set Textmerge To
Set Textmerge Off
EXECSCRIPT(m.lcScript)
BROWSE WIDTH 20
Cetin



>Doh! I was thinking that the 2nd number was the ending position, not the length. Thanks!
>
>>Your second column would end up being 500 characters in length, which I believe would force it to a memo. From your earlier description, don't you want something more like this?
>>
>>
>>CREATE CURSOR junk ( junk m )
>>INSERT INTO junk VALUES ( REPLICATE( "X", 5000 ) )
>>
>>SELECT TRANSFORM( SUBSTR( junk,   1, 250 ) ) AS junk1, ;
>>       TRANSFORM( SUBSTR( junk, 251, 250 ) ) AS junk2 ;
>>  FROM junk
>>
>>LIST STRUCTURE
>>
>>
>>I get data in both columns with that.
>>
>>>Sounded like a great idea, but only the first one (Description01) contains any values after the SQL runs. Any reason why the 2nd and subsequent ones would be empty?
>>>
>>>
>>>
>>>	TRANSFORM(SUBSTR(crsContributions.mNotes,1,250)) AS Description01, ;
>>>	TRANSFORM(SUBSTR(crsContributions.mNotes,251,500)) AS Description02, ;
>>>
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform