Hi,
I'm trying to save data to a tab-delimited text file with the script below. It works fine. My problem is saving the last bit of data "notes". This is a scrolling field that notes are put into and every time the RETURN key or ENTER key is pressed when entering data into the field it won't save it properly. When I import the data back into the fields it put only 1 sentence from the notes field into the batchName field (the 1st field) and the rest of the fields are blank.
Any ideas?
Thanks
on mouseUp
doEditExport
end mouseUp
on doEditExport
-- This custom message handler exports the contents of the database as
-- a tab-delimited text file (such as database programs can import).
put field "batchName" of card cFresh into tBatchName
ask file "Please name the file:" with tBatchName --"Exported Data"
-- The ask file command displays a dialog box where the user can specify
-- the name and location where a file is to be saved.
if it is empty then exit to top
-- The ask file command places the name and location of the file the user
-- chose in the "it" variable. If the user canceled instead of choosing a file,
-- "it" is empty. So if "it" is empty, the line above uses the exit to top command
-- to stop all pending handlers and cancel the menu choice.
put it into filePathToSave
-- The line above saves the file name and location in a variable called
-- "filePathToSave" so we can use it later in the handler.
put field "batchName" of card cFresh & tab \
& field "date" of card cFresh & tab \
& field "batch" of card cFresh & tab \
& field "weight" of card cFresh & tab \
& field "fredry" of card cFresh & tab \
& field "tConV" of card cFresh & tab \
& field "comment" of card cFresh & tab \
& field "notes" of card cFresh & return after dataToExport
-- The line above places the contents of the eight fields of the current
-- card at the end of a variable called "dataToExport". Each card's data
-- is placed after the previous card's data. (Notice the "\" characters
-- joining the four parts of this line. You can split a line this way if it's
-- too long to be convenient - the "\" makes Revolution read it as a single line.)
put dataToExport into URL ("file:" & filePathToSave)
-- The line above places the contents of the file into a variable called "fileData".
end doEditExport
save data from scrolling field to a tab-delimited text file
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: save data from scrolling field to a tab-delimited text file
Hi herbwords...
I have attached a stack that follows your instructions about how you want to save a .txt file... and then you can choose to load it... I hope it helps.
be well
Dixie
I have attached a stack that follows your instructions about how you want to save a .txt file... and then you can choose to load it... I hope it helps.
be well
Dixie
- Attachments
-
- export.rev.zip
- (2 KiB) Downloaded 258 times
Re: save data from scrolling field to a tab-delimited text file
Hi Herb,
you can use "urlencode/urldecode" to turn multiline text into oneline text and vice versa!
This is exactly what you need
Save data:
...
put TAB & urlencode(fld "field with many lines") & CR after Data2Export
...
Read data:
...
put urldecode(item 8 of Data2Import) into fld "field with many lines")
...
Best
Klaus
you can use "urlencode/urldecode" to turn multiline text into oneline text and vice versa!
This is exactly what you need

Save data:
...
put TAB & urlencode(fld "field with many lines") & CR after Data2Export
...
Read data:
...
put urldecode(item 8 of Data2Import) into fld "field with many lines")
...
Best
Klaus