Correct syntax fpr appending data
Jim Ault
JimAultWins at yahoo.com
Mon Mar 6 14:12:19 EST 2006
On 3/6/06 10:47 AM, "Ben Bock" <benbock at msn.com> wrote:
> What is the correct syntax for Rev to append data to the next line in a text
> file?
>
> I have a quiz in a standalone, and when the participant finishes, the file
> needs to save. the next particpant's scores should go on the next line. I
> use a button at the end of the quiz:
>
>
> on mouseUp
> set itemDelimiter to tab
> put fld "quiz_item1" into item 1 of line 1 of field "data field" of stack
> "data sample"
> put fld "quiz_item2" into item 2 of line 1 of field "data field" of stack
> "data sample"
> put fld "data field " into url "file:test data.txt"
> get url "file:test data.txt"
> put it into fld "sample field that proves to me something is going to the test
> data file"
> save url "file:test data.txt"
> end mouseUp
> 1) So how do I get the next person's data to enter the next line and save,
> without over writing the previous person's data?
> 2) Do you see flaws in this approach?
The way I like is to do:
put CR & fld dataField after url ("file:test data.txt")
or
put fld dataField & CR before url ("file:test data.txt")
or
put fld dataField & CR & CR before url ("file:test data.txt") --dbl space
or
put (CR & the seconds &CR&fld dataField & CR) after url ("file:test
data.txt")
If the file does not exist, one is created.
Caution: if the folder does NOT exist, nothing is written.
Jim Ault
Las Vegas
More information about the use-livecode
mailing list