Saving data from three text fields into a single file

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
urbaud
Posts: 120
Joined: Tue Feb 24, 2009 12:10 am

Saving data from three text fields into a single file

Post by urbaud » Mon Jan 30, 2012 12:53 am

I have a small program that has three text fields and each field has unique data in it. I wanted to save the data from each field into a single file so I wrote the code, posted below, to accomplish this task. However, I assume there must be another way(s) of doing the same thing, but I have been unable to think of alternate solutions. If there are other ways of accomplishing the same thing I’d be interested in seeing the code. I also believe there is a limit as to the amount of data that can be put into each item in the variable “onetwothree”, but I’m not sure what it is or whether this belief is correct.

Code: Select all

on mouseUp --save text from three flds into single file
   put fld "t1" into item 1 of onetwothree
   put fld "t2" into item 2 of onetwothree
   put fld "t3" into item 3 of onetwothree
   put onetwothree into url "file: test3fields.TXT"
end mouseUp

on mouseUp  --retrieve data and put into separate text flds
   get url "file: test3fields.TXT"
   put item 1 of it into fld "t1"
   put item 2 of it into fld "t2"
   put item 3 of it into fld "t3"
end mouseUp
urbaud

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10330
Joined: Wed May 06, 2009 2:28 pm

Re: Saving data from three text fields into a single file

Post by dunbarx » Mon Jan 30, 2012 2:49 am

No limit on the data.

Your code handles your data simply and cleanly. What else could you ask for? I assume that commas doe not exist in your data, of course.

Craig Newman

Post Reply