Import with variable delimiter

Raptorke

New Member
Hi is it possible to write a procedure to import files but one of the procedure parameters should be the delimiter character.

example.
Code:
def var delimchar$v as char no-undo format "X(1)".
 
assign delimchar$v = ";".
 
INPUT FROM c:\prices.csv.
 
REPEAT:
  IMPORT DELIMITER delimchar$v ...........
END.

Something like this. The above gives error but is there a way to accomplish this?

Greetings,

Raptor
 

Crittar

Member
Not as such. You could however write your code to generate the code for the import and run the generated code (something like this):

Code:
define variable delimchar$v as char no-undo format "X(1)".
 
output to tmpprog.p
 
put
  "INPUT FROM c:\prices.csv."
  skip
  "REPEAT:"
  skip
  "IMPORT DELIMITER " delimchar$v ...........
  skip
 "END."
output close
 
run tmpprog.p
 
Top