Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Append from text file help
Message
 
 
À
18/03/2003 11:39:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00767108
Message ID:
00767160
Vues:
10
This message has been marked as the solution to the initial question of the thread.
Hi Steve,

It would be easier to process this file with LLFF.
CLEAR
CREATE CURSOR crsTemp ( subgroup i, OutsideDia N(9,4))

lcFile = "st.txt"
lnFH = FOPEN(lcFile)
DO WHILE NOT FEOF(lnFH)
	lcStr = FGETS(lnFh, 8192)
	ALINES(laList, lcStr, .T., " ")
	DO CASE
	CASE UPPER(laList[1]) = ["SUBGROUP"]
		RELEASE laSubGroups
		ACOPY(laList, laSubGroups)
	CASE UPPER(laList[1]) = ["X"]
		FOR i=2 TO ALEN(laSubGroups)
			INSERT INTO crsTemp VALUES (VAL(laSubGroups[i]), VAL(laList[i]))
		ENDFOR
	
	ENDCASE	
		
ENDDO	

FCLOSE(lnFH)
It's basic code that doesn't have any error checking

>I have a text file that i need to pull into a table.
>
>The table looks like this:
>": OUTSIDE DIA.:"
>"NOM (LSL, USL) = 1.1875 (1.1870, 1.1875)"
>"Subgroup" 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
>"X" 1.1874 1.1873 1.1874 1.1872 1.1875 1.1875 1.1873 1.1873 1.1873 1.1872 1.1873 1.1873 1.1873 1.1872 1.1873 1.1874 1.1873 1.1873 1.1873 1.1873 1.1874 1.1873 1.1875 1.1873 1.1874 1.1874 1.1873 1.1874 1.1873 1.1874 1.1873 1.1872 1.1874 1.1873 1.1874 1.1873 1.1872 1.1872 1.1873 1.1873 1.1873 1.1873 1.1873 1.1873 1.1873 1.1873 1.1872 1.1873 1.1874 1.1873 1.1873 1.1873 1.1873 1.1874 1.1873 1.1873 1.1873 1.1873 1.1874 1.1873 1.1874 1.1874 1.1873 1.1873 1.1874 1.1872 1.1873
>
>EOF*****************
>
>When I try to use append from I get mixed results. Typically I only get the items that are conatined in quotes. The numeric values are not contained in quotes. They are separated by tabs.
>I have tried:
>"with blank" I get only the items in quotations
>"with tab" I get only the items in quotations
>with ' ' I get each entire line inside the field, this is the only way I have been able to get the numbers in, but the field lengths are too long, greater than 254.
>
>In the VFP help, it includes the following example:
>APPEND FROM mytxt.txt DELIMITED WITH _ ; WITH CHARACTER *
>
>However, when I try this example, I get an error, "command contains unrecognized phrase or key word? I am changing the charachter and delimiter of course.
>
>I am trying to acheive data organized as:
>subgroup Outside Dia
>1 1.1874
>2 1.1873
>3 1.1874
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform