To read the content of a text file into a Memo field. You can overwrite the existing Memo Field, Append the content of the file to it or insert the file content at the beginning of the Memo Field.
It is no secret that Import and Export possibilities has been somewhat "stumped" in DFW. In fact it hasn't bee technically so limited as our users seem to think, but for various reasons it has been perceived as much more limited than in DFD. This has mostly been down to niggling small bits that shut the functionality away from the users.
MemoReadFromFile() is simply a tool to read any formatted text into a Memo Field. This can be as an import/export feature in combination with MemoDecodePair(), part of processing in combination with MemoWriteToFile() - You build a text file instead of directly into a Memo Field and then read it back into DataEase via MemoReadFromFile(). It can be part of using HTML in your App... You decide!
In short this is simply a very flexible FileRead function that you can use for anything you like.
MEMO FIELD - Destination Memo
This is the destination Memo where the content of the file is read in to.
TEXT VALUE - File Path
The path to the text file you want to read into MEMO FIELD
NUMERICAL VALUE - Switch
The mode switch that decide which mode you want the file to be read in with:
0=Append value to memo field.
1=Overwrite memo field with new value.
2=Delete/Blank Content of memo field.
3=Insert value at beginning of memo field.
Example 1
We have a memo called MyMemo that contains "This is a test" and a text file MyText.txt that contains "This is a test too!". The text file is located in the app catalogue.
MemoReadFromFile(MyDestMemo,"MyText.txt",0)
Result in MyMemo: This is a testThis is a test too!
Example 2
We have a memo called MyMemo that contains "This is a test" and a text file MyText.txt that contains "This is a test too!". The text file is located in the app catalogue.
MemoReadFromFile(MyDestMemo,"MyText.txt",1)
Result in MyMemo: This is a test too!
Example 3
We have a memo called MyMemo that contains "This is a test" and a text file MyText.txt that contains "This is a test too!". The text file is located in the app catalogue.
MemoReadFromFile(MyDestMemo,"MyText.txt",3)
Result in MyMemo: This is a test too!This is a test
Example 4
We have a Document template stored in [users]/My Documents/DataEase/Templates/. It is a mail merging template that we will mail to the customers. It contains MailMerging Tags for Customer name.
MemoReadFromFile(MyMemo,concat(GetCurrent("MyDocuments","/DataEase/Templates/",MyFileNameField,1)
Next step is to replace the [{Customer}] tag with the content of the field CustomerName
MemoReplace(MyMemo,"[{Customer}]",Customer)
We have now read a document template from a relative catalogue on the current PC and prepared it for printing/mailing.
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 a WebField.
MemoReadFromFile has the same switches and formating as MemoWriteTo file.
int MemoReadFromFile(MemoToReadInto,Filename,Argument)
Argument:
0 - Append to Memo.
1 - Overwrite Memo
MemoReadFromFile
MemoDecodePair
MemoReplace
MemoReplace
WriteToFile
Product: Dataease [{8}]FIVE. Written by Simon B 11/03/15 at 10:33:27
Product: Dataease [{8}]FIVE. Written by DataEase 11/03/15 at 12:12:11
Product: Dataease [{8}]FIVE. Written by Simon B 11/03/15 at 14:33:29
Product: Dataease [{8}]FIVE. Written by DataEase 16/03/15 at 20:36:28
Product: Dataease [{8}]FIVE. Written by DataEase 20/03/15 at 10:34:53
Product: Dataease [{8}]FIVE. Written by Simon B 23/03/15 at 12:13:11
Product: Dataease [{8}]FIVE. Written by DataEase 25/03/15 at 14:21:47
Product: Dataease [{8}]FIVE. Written by DataEase 13/03/12 at 09:54:46