sander
sander

Reputation: 1654

UPDATE variable and OUTPUT TO filepath

I'm trying to ask a user to insert a filepath and then output the result to that filepath:

DEFINE VARIABLE outputPath AS CHARACTER FORMAT "x(50)".

UPDATE outputPath.
OUTPUT TO outputPath.

This doesn't seem to be working. But when I do for example:

OUTPUT TO "C:\temp\test.txt".

It seems to work.

Upvotes: 0

Views: 269

Answers (1)

Tom Bascom
Tom Bascom

Reputation: 14020

To use the value of a variable in an OUTPUT statement:

OUTPUT TO VALUE( outputPath ).

VALUE is also used with INPUT FROM, INPUT THROUGH and INPUT-OUTPUT THROUGH.

(A "naked" variable name will be treated as a file name, no quotes needed -- a result of one of those "makes a good demo" decisions 30 years ago...)

Upvotes: 8

Related Questions