Support Forum

INPUT command

Schlagworte:
  • 2014

Hello
in a data file, consisting of 2 series who do not necessarily always have the same number of values, I try to a make an INPUT from the 2nd series of data.
I therefore thought used the top of the 2nd series to begin the process of collecting the information, but I can't.

Here is the sample data file:

Data series 1:

alpha
bravo
charly
delta
echo
.
.
.

Data series 2:
1,25
2,35
3,45
4,55
5,66
.
.
.

Here is the sample code I thought use, I use a string of the title of the string to start collecting:

canal01 = OPEN ( "TEXT" , "data.txt" , "MODE=RO , fullpath , dialog" )
FOR i = 1 TO 6
n = INPUT ( canal01 , "Data series 2:" + i , 1 , nb )
p [ i ][ 1 ]= nb
PARAMETERS p [ i ][ 1 ]= p [ i ][ 1 ]NEXT i
CLOSE canal01

I cannot understand or is the error, and I even tried without a loop FOR n = INPUT ( canal01 , "Data series 2:" , 1 , nb ) it does not work either.
Here is what says the aid:

recordID (numerical or string): the string or numeric ID of the starting position of the reading.

Thanks for your help.
Olivier.

Administrateur forum : Allplan.leforum.eu

http://allplan.leforum.eu

Olivier1

Hello Olivier,

the recordID cannot be a string!

Here an example to read some values from an csv-file:

ch = OPEN ( "TEXT" , "f:\csv_file.txt" , "SEPARATOR = '\t', MODE = RO , FULLPATH , DIALOG" )
sep = 0.2
linecont = 1
DIM f [ ]nr = INPUT ( ch , linecont , 1 , f )
WHILE nr > -1 DO
FOR i = 1 TO VARDIM1 ( f )
IF VARTYPE ( f [ i ]) = 1 THEN
txt = STR ( f [ i ], 8 , 2 ) ! it a number
ELSE
txt = f [ i ]! its a string
ENDIF
TEXT2 0 , 0 , txt !f[i]cnt = cnt + 1
v = STW ( txt ) / 1000 * GLOB_SCALE !!!return value is in mm!!!!
TRANS2 v + sep , 0
NEXT i
RESTORE i
TRANS2 0 , 1
linecont = linecont + 1
nr = INPUT ( ch , linecont , 1 , f )
ENDWHILE

CLOSE ch

Regards

Jörg

Hello Jörg,

Thanks for your reply, I now understand.
I really thought that we could give an order of reading line from a recognition of character, I would do otherwise.

In your code, I think that you did with a version of Allplan 2014, because with with Allplan 2015, this code recognize me that 2 line and superimposes a 2nd lines the following information without taking into account the information of TRANS2 0.1.

CSV code of tests use:

Alpha bravo
Delta 1.25
2.0 3.00 4.00

Administrateur forum : Allplan.leforum.eu

http://allplan.leforum.eu

Olivier1

Anhänge (1)

Typ: image/png
284-mal heruntergeladen
Größe: 15,64 KiB