Function::File
ReadFromFile
ReadFromFile(Filename)
ReadFromFile("C:\temp\mytest.txt")
myJSON := ReadFromFile("C:\data\MyJSON.TXT") -- will return up to 4GB.
8.6 Onwards ONLY!
To read the content of a file and return it as the result of the function. With the limit of 255 removed on text buffers in DataEase a function that read a file and return it in its entirety is now required.
In 8.0-8.5 we used MemoReadFromFile() that set the returned value in a Memo. With the extension of Text buffers from 255 to 4GB this is no longer necessary as you can work with the text directly.
Parameters
TEXT : FilePath
The path and file name that you want to read and return.
Returns/Result
The content of the file up to 4GB.
If Error: :
-1 - no file name
-2 - file name present, but file is not found
-3 - memory allocation error
-4 - file reading error
Examples
Example 1
Where you before had to manipulate the memo to be able to read text files into DataEase you can now read and manipulate file content directly.
You can in a derivation or in a DQL ex. use the following code:
define "retval" memo .
retval := concat(Heading,ReadFromFile("C:\test\mybigfile.txt"),"/CRThis is my footer") .
list records
retval .
Modify recrods in mystore
MyBigText := Retval .
Reference
See Also
On the forum about ReadFromFile
MemoReadFromFile
Experimenting with this new function in a dql but unable to even get it to complile let alone run. he format is taking directly from the website 'help' for MemoReadFromFile.I've clearly got it in the wrong context but the help just...
Product: Dataease [{8}]FIVE. Written by Simon B 11/03/15 at 10:33:27
Re:MemoReadFromFile
1. THis is a prism function so it will update the Column in the Form not the GUI object, so it will actually read into the Column without you seeing it. This is intention as the same function is being used in DQL's etc, and all the GUI updating will s...
Product: Dataease [{8}]FIVE. Written by DataEase 11/03/15 at 12:12:11
Re:Re:MemoReadFromFile
Thank you.I keep getting caught out by this 'column function not gui function'. I'm used to dataease showing what i've done when i do it. I understand why you're approaching it this way but i wish it was made clearer for people like...
Product: Dataease [{8}]FIVE. Written by Simon B 11/03/15 at 14:33:29
Re:Re:Re:MemoReadFromFile
You can use all of these functions in DQL and anywhere in DataEase. That is the "point" of using the function format for new functionality.Where commands can only be used in DQL, a function can be used in Derivation/Validation/DQL/OML i.e. eve...
Product: Dataease [{8}]FIVE. Written by DataEase 16/03/15 at 20:36:28
MemoWriteToFile(),MemoReadFromFile(),MemoStringFrom(), MemoStringBetween() sample
Download Sample
Seeing is believing, so please find attached a sample that showcase what you are looking for.
In this sample we...
Product: Dataease [{8}]FIVE. Written by DataEase 20/03/15 at 10:34:53
Re:MemoWriteToFile(),MemoReadFromFile(),MemoStringFrom(), MemoStringBetween() sample
Got some time to sit down to look at this example. Can't say much more than wow! ... Simple small scripts doing some clever stuff here, ans showing how to use functions to do the type of thing I'm looking for.Also showing off other things...
Product: Dataease [{8}]FIVE. Written by Simon B 23/03/15 at 12:13:11
Re:Re:MemoWriteToFile(),MemoReadFromFile(),MemoStringFrom(), MemoStringBetween() sample
We are glad that you are getting a glimpse of the sunny side of the DE8 coin.It is the biggest challenge for DE8 that it is deceptively similar to previous versions of DFW, when in reality it is a completely different beast altogether.<b...
Product: Dataease [{8}]FIVE. Written by DataEase 25/03/15 at 14:21:47
On the blog about ReadFromFile
New Function in 8 - MemoReadFromFile() - Read the content of a text file to a Memo (Ver. 8.0.0.1054)
This is the complimentary function to MemoWriteToFile, and it simply read the content of a File into a Memo field.It reads it as Text. If you read an HTML file, it will display as HTML code in a normal Memo Editbox field, and as the Webpage in...
Product: Dataease [{8}]FIVE. Written by DataEase 13/03/12 at 09:54:46
MemoWriteToFile(),MemoReadFromFile(),MemoStringFrom(), MemoStringBetween() sample
Download Sample
Seeing is believing, so please find attached a sample that showcase what you are looking for.
In this sample we...
Product: Dataease [{8}]FIVE. Written by DataEase 20/03/15 at 10:47:00