Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
PROBLEM: SELECT into ARRAY not respect RTRIM()
Message
 
 
À
06/09/2003 10:09:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00826732
Message ID:
00826734
Vues:
20
Fabio,

SELECT can not return a variable length field. The size of the field will be determined by VFP examining a row from the table, it's usually the first row, but doesn't have to be. So if VFP determines that rtrim() returns a string of length 10 it will size the field c(10) and values that are longer than that in the source will actually be truncated.

It doesn't matter what the INTO clause is, array or cursor the column size is fixed.

It's easiest to just rtrim() the array elements in a loop. VFP is pretty fast (it's nearly as fast as C/C++) for most string operations.

>With a SELECT, i cannot put trimmed string on array.
>
>
>CLEAR
>CREATE CURSOR myCursor (f1 c(20))
>INSERT INTO myCursor VALUES ('A')
>
>SELECT RTRIM(f1) FROM myCursor INTO ARRAY aResult
>? LEN(aResult[1])
>
>
>This because SELECT .. INTO ARRAY aResult is implement with a tmpCursor (?):
>
>SELECT ... INTO CURSOR tmpCursor
>COPY TO ARRAY aResult
>USE IN tmpCursor
>
>
>The only way is to trim array elements with a FOR Cycle ?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform