Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
APPEND FROM inconsistencies
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
01085187
Message ID:
01085329
Vues:
23
>>This routine creates a Tab Delimited textfile tabdeli.txt:
#define ccTAB	chr(9)
>>#define ccCRLF	chr(13)+chr(10)
>>
>>local lcT
>>
>>lcT = ;
>>	'a'   + ccTAB + 'b'   + ccTAB + 'c'   + ccTAB + 'd'   + ccCRLF + ;
>>	        ccTAB +         ccTAB +         ccTAB +       + ccCRLF + ;
>>	'"e"' + ccTAB + '"f"' + ccTAB + '"g"' + ccTAB + '"h"' + ccCRLF + ;
>>	        ccTAB +         ccTAB +         ccTAB +       + ccCRLF + ;
>>	        ccTAB +         ccTAB +         ccTAB +       + ccCRLF + ;
>>	"'i'" + ccTAB + "'j'" + ccTAB + "'k'" + ccTAB + "'l'" + ccCRLF + ;
>>	        ccTAB +         ccTAB +         ccTAB +       + ccCRLF + ;
>>	'm'   + ccTAB + 'n'   + ccTAB + 'o'   + ccTAB + 'p'   + ccCRLF
>>
>>strtofile( m.lcT, 'tabdeli.txt' )
>>
>>Now create a cursor tabdeli:
create cursor tabdeli (f1 c(5),f2 c(5),f3 c(5),f4 c(5))
>>
>>Now do the next variations of APPEND FROM from the command window and browse the results:
append from tabdeli.txt type delimited with "" with character TAB
>>append from tabdeli.txt type delimited with "  with character TAB
>>append from tabdeli.txt type delimited with '' with character TAB
>>append from tabdeli.txt type delimited with '  with character TAB
>>
>>Notice that line 1 gives weird results. Line 2 gives the expected result. Line 3 gives the expected result. Line 4 gives an error.
>>This is, at the least, inconsistent behavior. It is also an indication that the much adviced use of TWO double-quotes is 'wrong'.
>>
>>These findings have been reproduced in vfp7 and vfp9.
>
>Peter,
>
>I doubt that you may get consistent result with inconsistent information here. The delimited format has limitations, and you ran in one of it when using delimiters that were already used as information piece.

How do you mean, inconsistent information?

>You need to use the delimiter other than double or singles quotes here.

Most notably the 1st statement is often advised here.

>By the way, I did not have any problem with your fourth statement; and it was the only one that gave the consistent result.

What a coincidence! For the sake of clear code I added a space behind the quote. Please redo the statement, but now without the additional space:
append from tabdeli.txt type delimited with '  with character TAB
append from tabdeli.txt type delimited with ' with character TAB
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform