Insert or append a standard DataEase field or string value into a Memo Field.
Memo is a new field class in DataEase 8 with it's own functions to manipulate and bridge the gap between traditional DataEase functionality and Memo. Memo will not work with standard functions like Jointext(), Concat() etc. because they can only manipulate 246 bytes at a time.
MemoCopy() is designed to insert/append any traditional DataEase value into any Memo field. You can insert it at the beginning, overwrite the Memo, delete/blank the current value or simply append it at the end.
It is designed to be used for building Memo content dynamically or to manipulate Memo fields by adding content. It can be used both for normal text adding (export etc.) or it can be used for adding coding like html/CSS etc.
This function can be called from a Button (Action), a derivation (i.e field derivation or validation) or be used as a part of a DQL query to populate a Memo list, export creation, web page build etc.
MemoField
the field that will be manipulated by this function. It need to be of Memo Class. If one try to use MemoCopy() on a field that is not of memo class, nothing will happen.
Field
You can use any standard derivation for this parameter. ex. Concat("My names is: ", current user name) or Lookup Customer Customername or spelldate(current date).Value to be appended or inserted into MemoField. This value is of type String(256). You can append any DataEase field to a Memo field with MemoCopy and it will be represented correctly as the function will translate them to string.If you want to append a constant you need to use "" i.e. "My personal message" or "12/12/12" if it is a date. or "£1,234.45" if it is a currency number.
Switch
This parameter control the behaviour of MemoCopy().
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.
4=Append value to Memo with CR in front (Start on new line)
5=Insert value at beginning of memo with CR after.
You will find an extensive example on how to get best use of this function in our Tutorial Database which is shipped with DataEase 8.
For this example we have Memo field MyMemo that contains the text:
"And the winner is"
Example 1
MemoCopy(MyMemo,"Peter Griffin",0)
Result: And the winner is Peter Griffin.
Example 2
MemoCopy(MyMemo,"Peter Griffin",1)
Result: Peter Griffin
Example 3
MemoCopy(MyMemo,"Peter Griffin",2)
Result: <Nothing>
Example 4
MemoCopy(MyMemo,"Peter Griffin",0)
Result: Peter Griffin And the winner is.
Example 5
MemoCopy(MyMemo,concat("This is the results of the Norwegian Jury!",chr(13),chr(10)),3)+MemoCopy(MyMemo,"Peter Griffin",0)
Result:
The Result of the Norwegian Jury!
And the winner is Peter Griffin.
We see here that we get a carriage return after the new heading. This can be very useful when you are going to build documents etc in Memo fields or diretctly in Text fields with WriteToFile() etc.
Example 6
This is a real example from our Avanced Email Example in the Default template in 8. Here we combine MemoCopy with the External Function GetFileName the new function GetCurrent() and the result is quite exhilarating.
MemoCopy(Attachments,concat(GetFileName("","",GetCurrent("MyDocuments")),","),0)
What hapens here is:
1. When we click on the Button Attach File, we get a Select File dialogue that points directly on YOUR My Documents catalogue. You can then browse till you find your attachment (You can of course add a further structure behind My Documents etc).
2. You select the file you want to attach and click Open.
3. The file name gets appended to the Attachment Field in the Email.
Suddenly the normal limitations of one value in a field etc. is gone. You can attach as many attachments as you please. This list is later written to a file via a virtual field, and attached via the emailing functionality.
Memo Function
Copies, Appends or Inserts a Field or a constant into a Memo field.
This function is part of the Memo manipulation class which bridge the gap between Memo and standard DataEase type fields like Text, Number, Numeric String, Date, Time, Choice etc.
This is a very useful function if you would like to build a document/storage in a Memo field for instance for export, or for presentation in WebField.
Syntax
MemoCopy (MemoToCopyTo,FieldToCopyFrom,Switch)
? MemoToCopy to is the memofield you want to insert,append or overwrite.
? FieldToCopyFrom is the field/constant you want to insert,append to the memo
? Switch is: 0 = Append, 1= Overwrite, 2=Insert at beginning.
Returns
An empty string so the function can be called as a part of any formula without interfering with content of field.
Example
Memofield Body contains: DataEase 8 is great! before we execute function
MemoCopy(Body,"This is a test!",0)
? would result in the content of Body being: DataEase 8 is great! This is a test!
MemoCopy(Body,"This is a test!",1)
? would result in the content of Body being: This is a test!
MemoCopy(Body,"This is a test!",2)
? would result in the content of Body being: This is atest! DataEase 8 is great!
Complimentary Functions
MemoMemoCopy() - same function but copies, inserts or overwrite a Memo with another Memo.
WriteToFile() - Function that will perform the same functionality, but write to a file instead of a Memo.
Chr() - Function that returns the ASCII character for a number, you will need this to insert " or NewLine into a Memo.
MemoWriteToFile() - Same as WriteToFile() but writes, inserts or appends a memo to a file.
MemoReadFromFile() - Reads a file into a memo.
WriteToFile
MemoMemoCopy
MemoReadFromFile
MemoWriteToFile
MemoReplace
Product: Dataease [{8}]FIVE. Written by grohmann.papier@t-online.de 07/05/15 at 12:10:59
Product: Dataease [{8}]FIVE. Written by grohmann.papier@t-online.de 08/05/15 at 20:10:43
Product: Dataease [{8}]FIVE. Written by DataEase 11/05/15 at 12:39:50
Product: Dataease [{8}]FIVE. Written by 05/05/18 at 10:30:39
Product: Dataease [{8}]FIVE. Written by 17/10/19 at 12:14:13
Product: Dataease [{8}]FIVE. Written by DataEase 17/10/19 at 12:17:09
Product: Dataease [{8}]FIVE. Written by afonso santos 12/08/20 at 02:17:56
Product: Dataease [{8}]FIVE. Written by DataEase 14/08/20 at 11:50:33
Product: Dataease [{8}]FIVE. Written by afonso santos 16/08/20 at 18:42:22
Product: Dataease [{8}]FIVE. Written by DataEase 29/09/11 at 12:32:32
Product: Dataease [{8}]FIVE. Written by DataEase 27/09/11 at 12:40:13